Skip to content

Commit

Permalink
fix(nextauth): auth0
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren committed Nov 21, 2024
1 parent 9793fb2 commit 02d3a96
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions keep-ui/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,14 @@ const config = {
},
jwt: async ({ token, user, account }): Promise<JWT> => {
if (account && user) {
let accessToken: string | undefined;
// Ensure we always have an accessToken
const accessToken =
user.accessToken || account.access_token || account.id_token;
if (authType == AuthType.AUTH0) {
accessToken = account.id_token;
} else {
accessToken =
user.accessToken || account.access_token || account.id_token;
}
if (!accessToken) {
throw new Error("No access token available");
}
Expand Down

0 comments on commit 02d3a96

Please sign in to comment.