Skip to content

[v3] Google OAuth (via react-native-oauth) -> Firebase #159

Open
@ajonno

Description

@ajonno

I need a bit of help with this one. I've implemented react-native-oauth (iOS) for Google auth, and its returning a payload, all is good there.

what I cant work out now is how do i "tie" that into Firebase, so that i can complete things and register/create the user on Firebase ? the response payload from ..-auth0 has 'credentials' and 'access-token' that I can see. can i use that to then authenticate with Firebase (Im using the Firestack lib :-)

Activity

added this to the v3 milestone on Nov 23, 2016
changed the title [-]Google OAuth (via react-native-oauth) -> Firebase[/-] [+][v3] Google OAuth (via react-native-oauth) -> Firebase[/+] on Nov 23, 2016
ajonno

ajonno commented on Nov 23, 2016

@ajonno
Author

Any help is appreciated we're on a bit of a tight deadline with this one

auser

auser commented on Nov 24, 2016

@auser
Contributor
ajonno

ajonno commented on Nov 24, 2016

@ajonno
Author

i did try that with Facebook and was fine/works.

but Google didnt like the access_token. ill double back to post the error response here shortly

ajonno

ajonno commented on Nov 24, 2016

@ajonno
Author

here is the error:

  1. the manager.authorize(.. IS succeeding for Google auth
  2. Firestack is throwing the error attached

here is the code block. i suspect im missing a param somewhere?

manager.authorize('google', {scopes: 'profile email'})
         .then(resp =>   {
            console.log('GOOGLE authorize response: ', resp)

            firestack.signInWithProvider('google', resp.response.credentials.access_token, '') // facebook need only access token.
            .then((user)=>{
               console.log('(FIRESTACK) GOOGLE AUTH response:', user)
            }) 
            .catch(err => console.log(err));

         })
         .catch(err => console.log(err));

image

matthewjamieson

matthewjamieson commented on Dec 15, 2016

@matthewjamieson

+1 same issue for me as well

matthewjamieson

matthewjamieson commented on Dec 15, 2016

@matthewjamieson

Found the Solution.
change resp.response.credentials.access_token to resp.response.credentials.idToken

#130

https://gist.github.com/auser/87e6a25da0b25c465dd0db097b8864ca#file-firebase_google_login-js-L108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @auser@ajonno@Salakar@matthewjamieson

        Issue actions

          [v3] Google OAuth (via react-native-oauth) -> Firebase · Issue #159 · fullstackreact/react-native-firestack