Skip to content

NextAuth Strava Provider - Unable to get accessToken back #10049

Closed Answered by james-millner
james-millner asked this question in Help
Discussion options

You must be logged in to vote

Frustratingly found this out moments after posting this, but will share for visibility:

I needed to add a callback to get this.

Although this isnt explicit in the docs

const handler = NextAuth({
    providers: [
        StravaProvider({
            clientId: process.env.STRAVA_CLIENT_ID,
            clientSecret: process.env.STRAVA_CLIENT_SECRET,
            token: {
                async request({ client, params, checks, provider }) {
                    const { token_type, expires_at, refresh_token, access_token } =
                        await client.oauthCallback(provider.callbackUrl, params, checks);

                    console.log('token_type', token_type);
                    con…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by james-millner
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants