Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code example for Google Social Auth in docs. #8226

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LynixPlayz
Copy link

Description

After trying to use the docs to create a google sign in. I realized that GoogleSignin.signIn() gives back an object that looks like this

{"data": {"idToken": "{idToken}", "scopes": ["openid", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"], "serverAuthCode": "{authCode}", "user": {userInfo}}, "type": "success"}

I realized that the docs stated that I should create a google credential with data.token and not data.idToken

 // Create a Google credential with the token
 const googleCredential = auth.GoogleAuthProvider.credential(signInResult.data.token);

This would give you an error because googleCredential has some undefined params.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan


Think react-native-firebase is great? Please consider supporting the project with any of the below:

Copy link

vercel bot commented Jan 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-firebase ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 14, 2025 6:14am

@CLAassistant
Copy link

CLAassistant commented Jan 14, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed - good catch. I suppose with typescript the IDE would have just suggested the correct thing so few people have seen this but the example has been incorrect for a while I think!
Your proposal matches the above code so must be more correct

https://github.com/invertase/react-native-firebase/pull/8226/files#diff-53e96a246d40e076b9c83969fde7f154711d5dfe3b3f8118aaf2e6e89f747723R318

thanks

@mikehardy mikehardy added the Workflow: Pending Merge Waiting on CI or similar label Jan 14, 2025
@mikehardy mikehardy enabled auto-merge (squash) January 14, 2025 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Workflow: Pending Merge Waiting on CI or similar
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants