-
Provider typeCustom provider EnvironmentSystem: Reproduction URLnone Describe the issueWhen using custom providers, the token.url is never called to get the acesss token after a successful authorization is done. How to reproduceUsing a config like this: import NextAuth from 'next-auth'
import axios from 'axios'
export default NextAuth({
debug: true,
secret: 'redacted', // openssl rand -base64 32
session: {
strategy: 'jwt'
},
providers: [
{
id: 'custom-provider',
name: 'my custom provider',
clientId: 'redacted',
type: 'oauth',
issuer: 'https://redacted.com',
authorization: {
url: 'https://redacted/v1/oauth2/auth',
params: {
scope: 'redacted',
redirect_uri: 'http://localhost:3000/api/auth/callback/redacted',
response_type: 'code',
code_challenge_method: 'S256'
}
},
token: {
url: 'https://redacted/v1/oauth2/token' // <--- never called
},
checks: ['pkce', 'state'],
}
]
}) Expected behaviorwhen using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I figured it out. It was because I declared a custom |
Beta Was this translation helpful? Give feedback.
I figured it out. It was because I declared a custom
redirect_uri
in my authorization block and had a corresponding file for that redirect. Apparently that is not needed at all, you don't need a file for the callback because next-auth does magic during the callback. Just need to make sure that the actualredirect_uri
that next-auth uses is whitelisted on your provider, then everything else should work.