-
I'm using Strava provider in Auth.js ( Using the My import NextAuth from "next-auth";
import Strava from "next-auth/providers/strava";
export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [
Strava({
authorization: {
params: {
scope: "activity:read_all",
},
},
}),
],
}); |
Beta Was this translation helpful? Give feedback.
Answered by
felixerdy
Dec 23, 2024
Replies: 1 comment
-
After a night of sleep I got it running with the following import NextAuth from "next-auth";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { JWT } from "next-auth/jwt";
import Strava from "next-auth/providers/strava";
declare module "next-auth" {
interface Session {
accessToken: string;
}
interface Account {
access_token: string;
}
}
declare module "next-auth/jwt" {
interface JWT {
accessToken: string;
}
}
export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [
Strava({
authorization: {
params: {
scope: "activity:read_all",
},
},
}),
],
callbacks: {
async jwt({ token, account }) {
if (account) {
token.accessToken = account.access_token;
}
return token;
},
async session({ session, token }) {
session.accessToken = token.accessToken;
return session;
},
},
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
felixerdy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After a night of sleep I got it running with the following
auth.ts
: