diff --git a/src/auth/providers/queries.ts b/src/auth/providers/queries.ts index b23dc06ef7..74f1f91494 100644 --- a/src/auth/providers/queries.ts +++ b/src/auth/providers/queries.ts @@ -6,6 +6,7 @@ export const SIGN_IN_WITH_THE_KEY_MUTATION = gql` input: { keyAccessToken: $accessToken, anonymousUid: $anonymousUid } ) { token + refreshToken } } `; @@ -16,6 +17,7 @@ export const SIGN_IN_WITH_FACEBOOK_MUTATION = gql` input: { fbAccessToken: $accessToken, anonymousUid: $anonymousUid } ) { token + refreshToken } } `; @@ -24,6 +26,7 @@ export const SIGN_IN_WITH_GOOGLE_MUTATION = gql` mutation SignInWithGoogle($idToken: String!, $anonymousUid: String) { loginWithGoogle(input: { idToken: $idToken, anonymousUid: $anonymousUid }) { token + refreshToken } } `; diff --git a/src/auth/providers/useSignInWithFacebook.ts b/src/auth/providers/useSignInWithFacebook.ts index 4f0a12d22a..0c47b95119 100644 --- a/src/auth/providers/useSignInWithFacebook.ts +++ b/src/auth/providers/useSignInWithFacebook.ts @@ -6,6 +6,7 @@ import { setAuthToken, getAnonymousUid, deleteAnonymousUid, + setMissionHubRefreshToken, } from '../authStore'; import { AuthError } from '../constants'; import { rollbar } from '../../utils/rollbar.config'; @@ -69,6 +70,9 @@ export const useSignInWithFacebook = () => { if (data?.loginWithFacebook?.token) { await setAuthToken(data.loginWithFacebook.token); + await setMissionHubRefreshToken( + data.loginWithFacebook?.refreshToken || '', + ); await deleteAnonymousUid(); } else { throw new Error('apiSignInWithFacebook did not return an access token'); diff --git a/src/auth/providers/useSignInWithGoogle.ts b/src/auth/providers/useSignInWithGoogle.ts index 6f4226c871..6692435d22 100644 --- a/src/auth/providers/useSignInWithGoogle.ts +++ b/src/auth/providers/useSignInWithGoogle.ts @@ -9,6 +9,7 @@ import { setAuthToken, getAnonymousUid, deleteAnonymousUid, + setMissionHubRefreshToken, } from '../authStore'; import { AuthError } from '../constants'; import { rollbar } from '../../utils/rollbar.config'; @@ -90,6 +91,9 @@ export const useSignInWithGoogle = () => { if (data?.loginWithGoogle?.token) { await setAuthToken(data.loginWithGoogle.token); + await setMissionHubRefreshToken( + data.loginWithGoogle?.refreshToken || '', + ); await deleteAnonymousUid(); } else { throw new Error('apiSignInWithGoogle did not return an access token'); diff --git a/src/auth/providers/useSignInWithTheKey.ts b/src/auth/providers/useSignInWithTheKey.ts index a25b3effa0..3f31272828 100644 --- a/src/auth/providers/useSignInWithTheKey.ts +++ b/src/auth/providers/useSignInWithTheKey.ts @@ -19,6 +19,7 @@ import { getTheKeyRefreshToken, setTheKeyRefreshToken, deleteAnonymousUid, + setMissionHubRefreshToken, } from '../authStore'; import { AuthError } from '../constants'; import { rollbar } from '../../utils/rollbar.config'; @@ -193,6 +194,9 @@ export const useSignInWithTheKey = () => { if (data?.loginWithTheKey?.token) { await setAuthToken(data.loginWithTheKey.token); + await setMissionHubRefreshToken( + data.loginWithTheKey?.refreshToken || '', + ); await deleteAnonymousUid(); } else { throw new Error('apiSignInWithTheKey did not return an access token');