Hi Im using nextjs and nextauth for authentication I have google facebook and instagram all working and its very simple. Spotify does not want to work. When I click it to sign in I get INVALID_CLIENT: Invalid redirect URI on the spotify dashboard i have the URI as "http://localhost:3000/api/auth/spotify" below is my code, Can someone point in me in the right direction
import NextAuth from "next-auth"
import GoogleProvider from "next-auth/providers/google"
import FacebookProvider from "next-auth/providers/facebook"
import LinkedInProvider from "next-auth/providers/linkedin"
import TwitterProvider from "next-auth/providers/twitter"
import InstagramProvider from "next-auth/providers/instagram"
import SpotifyProvider from "next-auth/providers/spotify"
const handler = NextAuth({
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET
}),
LinkedInProvider({
clientId: process.env.LINKEDIN_CLIENT_ID,
clientSecret: process.env.LINKEDIN_CLIENT_SECRET
}),
TwitterProvider({
clientId: process.env.TWITTER_CLIENT_ID,
clientSecret: process.env.TWITTER_CLIENT_SECRET
}),
InstagramProvider({
clientId: process.env.INSTAGRAM_CLIENT_ID,
clientSecret: process.env.INSTAGRAM_CLIENT_SECRET
}),
SpotifyProvider({
clientId: process.env.SPOTIFY_CLIENT_ID,
clientSecret: process.env.SPOTIFY_CLIENT_SECRET,
redirectUri: 'http://localhost:3000/api/auth/spotify'
}),
FacebookProvider({
clientId: process.env.FACEBOOK_CLIENT_ID,
clientSecret: process.env.FACEBOOK_CLIENT_SECRET
})
],
pages: {
signIn: '/user',
},
})
export { handler as GET, handler as POST }
The issue was with the with the url in the redirect api i should of been
after that the authentication worked juts fine so it was a simple spelling error
http://localhost:3000/api/auth/callback/spotify