Skip to content

Commit

Permalink
[2/2]fix: Link existing users to identity providers on user exists error
Browse files Browse the repository at this point in the history
  • Loading branch information
sashko9807 committed Jun 8, 2024
1 parent 37fbf5b commit 09434a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ export const authOptions: NextAuthOptions = {
account.access_token,
account.provider,
token.picture ?? '',
token.sub ?? '',
token.email ?? '',
token.name ?? '',
)
return {
accessToken: keycloakToken.accessToken,
Expand Down
5 changes: 4 additions & 1 deletion src/service/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,14 @@ export async function getAccessTokenFromProvider(
token: string | undefined,
provider: string,
picture: string,
userId: string,
email: string,
name: string,
): Promise<JWT> {
try {
const response = await apiClient.post<AuthResponse>(
endpoints.auth.providerLogin.url,
{ providerToken: token, provider, picture },
{ providerToken: token, provider, picture, userId, email, name },
{
headers: { 'Content-Type': 'application/json' },
method: 'POST',
Expand Down

0 comments on commit 09434a6

Please sign in to comment.