invertase / invertase/react-native-firebase
🚀 [auth] Include access token and ID token in auth result
- Dominant language
- TypeScript
- Stars
- 12.3k
- Forks
- 2.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 79
Description
The upstream SDKs for iOS, Android and web allow you to get the user, additional user info, the access token and the ID token after doing an OpenID Connect sign-in. For the access token and the ID token:
- Android: Available via [AuthResult.getCredential ](https://firebase.google.com/docs/reference/kotlin/com/google/firebase/auth/AuthResult), shown in step 4 here: https://firebase.google.com/docs/auth/android/openid-connect#handle_the_sign-in_flow_with_the_firebase_sdk
- iOS: Available via [AuthDataResult.credential](https://firebase.google.com/docs/reference/swift/firebaseauth/api/reference/Classes/AuthDataResult), shown in step 6 here: https://firebase.google.com/docs/auth/ios/openid-connect#handle_the_sign-in_flow_with_the_firebase_sdk
- Web: Available via calling `OAuthProvider.credentialFromResult` with [UserCredential](https://firebase.google.com/docs/reference/js/auth.usercredential), shown in step 4 here: https://firebase.google.com/docs/auth/web/openid-connect#handle_the_sign-in_flow_with_the_firebase_sdk
However, this wrapper only seems to expose the user and the additional user info. The auth result is handled by `promiseWithAuthResult` on Android and iOS, and you can see that they only return those two:
- https://github.com/invertase/react-native-firebase/blob/main/packages/auth/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java#L2179
- https://github.com/invertase/react-native-firebase/blob/main/packages/auth/ios/RNFBAuth/RNFBAuthModule.m#L1595
On the React Native side the result goes on to `_setUserCredential`: https://github.com/invertase/react-native-firebase/blob/main/packages/auth/lib/index.js#L181
It would be useful to have parity with the upstream by including the tokens as well.
Contributor guide
Assessment
This issue has not been assessed yet.