I'm using NextAuth with Patreon, after allowing access I get redirected back to my url, but there is the "code" added in the url parameter. I thought NextAuth was supposed to handle this process of passing the code, getting the access token back, and then passing it back for user data. This appears to be handled automatically for Github or Google as is shown in the docs here: https://next-auth.js.org/configuration/providers/oauth
Why is the redirect coming back to the browser with the code added for Patreon, do I need to handle this process manually somehow? I'll also mention that I needed to explicitly add the redirect_uri in the provider to prevent a mismatch error I was getting. Here is the provider code:
const handler = NextAuth({
providers: [
PatreonProvider({
clientId: process.env.PATREON_CLIENT_ID,
clientSecret: process.env.PATREON_CLIENT_SECRET,
authorization: {
params: {
redirect_uri: "example.com",
},
},
}),
],
});
This is apparently what happens when you don't set the redirect url properly during set up. Needs to be localhost:3000/api/auth/callback/patreon... at least assuming /api/auth/ is where the [...nextauth] folder is located.