Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
BUGFIX: fix sign-in bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hueyy committed Feb 7, 2021
1 parent c603ea1 commit 3d7cce6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
44 changes: 28 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -66,7 +66,7 @@
"expo-analytics-amplitude": "~10.0.0",
"expo-app-loading": "^1.0.1",
"expo-asset": "^8.2.2",
"expo-auth-session": "^3.1.0",
"expo-auth-session": "~3.0.0",
"expo-blur": "^9.0.0",
"expo-constants": "^10.0.1",
"expo-device": "^3.1.1",
Expand Down
9 changes: 7 additions & 2 deletions redux/actions/userActions.ts
@@ -1,6 +1,7 @@
import * as AuthSession from 'expo-auth-session'
import { Action } from "redux"
import { ThunkAction, ThunkDispatch } from "redux-thunk"
import { Alert } from 'react-native'
import configureStore, { AppStateType } from "../../configureStore"
import { ASSISTANT_API_URL } from "../../constants/API"
import { AnalyticsManager, ErrorManager } from "../../lib"
Expand Down Expand Up @@ -58,11 +59,14 @@ export const signIn = (): UserThunkAction => async (
dispatch: UserDispatch,
): Promise<void> => {
dispatch(isSigningIn())
const returnUrl = AuthSession.makeRedirectUri()
const returnUrl = `${AuthSession.makeRedirectUri()}redirect`
const result = await AuthSession.startAsync({
authUrl: `${ASSISTANT_API_URL}/connect/uclapi?return=${encodeURIComponent(
returnUrl,
)}`
)}`,
// specify optional parameter returnUrl to work around bug
// https://github.com/expo/expo/issues/6679#issuecomment-637032717
returnUrl,
})
if (result.type === `success`) {
const action = signInSuccess(result)
Expand All @@ -72,6 +76,7 @@ export const signIn = (): UserThunkAction => async (
dispatch(action)
return null
}
Alert.alert(result.type, returnUrl)
// login cancelled by user.
dispatch(signInCancel())
return null
Expand Down

0 comments on commit 3d7cce6

Please sign in to comment.