idToken undefined in result.authentication (authSession with Google)
See original GitHub issueSummary
When getting a response back from promptAsync using AuthSession with Google, I get an authentication value with an undefined id_token. I know I can get the id_token by itself but I’m looking for both an access token and id_token in the same response because I can’t think of an elegant workaround to get both separately using this library (each would have to prompt the user with a popup, and worse you would have to trigger popups by asking the user to click two buttons or disable pop up blocker)
Managed or bare workflow? If you have ios/
or android/
directories in your project, the answer is bare!
managed
What platform(s) does this occur on?
Web
SDK Version (managed workflow only)
40
Environment
Expo CLI 4.2.1 environment info: System: OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa) Shell: 5.0.17 - /bin/bash Binaries: Node: 12.18.1 - ~/.nvm/versions/node/v12.18.1/bin/node Yarn: 1.22.5 - /usr/local/bin/yarn npm: 6.14.5 - ~/.nvm/versions/node/v12.18.1/bin/npm Watchman: 4.9.0 - /usr/bin/watchman npmPackages: expo: ~40.0.0 => 40.0.1 react: 16.13.1 => 16.13.1 react-dom: * => 17.0.2 react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2 react-native-web: ~0.13.12 => 0.13.18 react-navigation: latest => 4.4.4 npmGlobalPackages: expo-cli: 4.2.1 Expo Workflow: managed
Reproducible demo or steps to reproduce from a blank project
Just using the same code as in the docs – but not doing it on snack (since you can’t even enter your credentials there with google sign in). Other people have also seen this bug, see these links: https://stackoverflow.com/questions/66966772/expo-auth-session-providers-google-google-useauthrequest and https://forums.expo.io/t/expo-auth-session-google-useauthrequest-returns-googles-idtoken-value-as-undefined/49510
Issue Analytics
- State:
- Created 2 years ago
- Reactions:12
- Comments:27
Top GitHub Comments
Same here: There seems to be a bug in the
expo-auth-session/providers/google
v 3.2.3 package that returns idToken as undefined when callingGoogle.useAuthRequest
. I’m testing on Expo Go, everything configured correctly as documentation says, web proxy credentials, everything. The only solution that worked for me to getidToken
is this code provided by howard:This code is a workaround to get
idToken
(in the “params” key) and no other data.The old package
expo-google-app-auth
seems to be returning idToken correctly along with other data.Edit: I’ve found
Google.useIdTokenAuthRequest
that can be used instead ofGoogle.useAuthRequest
but seems to do the same thing than the code above. Maybe by design in the package it’s not possible to get idToken and other information at the same time. Also thisGoogle.useIdTokenAuthRequest
hook is undocumented except when you click on the firebase tab in the code example of this pageSame issue here. Using Google.useAuthRequest and the idToken on the response object is undefind.