React Native third-party auth

532 views
Skip to first unread message

Cem Turan

unread,
Jul 17, 2015, 10:56:33 AM7/17/15
to fireba...@googlegroups.com
Is it in any way possible to do third-party auth for firebase on react-native? 
I've tried embedding the .js library in a webview, but the webview does not seem to support authWithOAuthPopup?

So far the only solution I've found is using Auth0 for oauth, but i'd rather rely on as few providers as possible:

Michael Lehenbauer

unread,
Jul 17, 2015, 5:18:26 PM7/17/15
to fireba...@googlegroups.com
Hey Cem,

It's certainly possible though not as easy as we'd like. :-) 

The basic approach would be to do a normal native login (e.g. using the iOS Facebook SDK) and then pass the resulting oauth token to ref.authWithOAuthToken().

If you're interested in Facebook specifically, this blog post walks you through using facebook login in a react-native app.  So I'd follow through that procedure.  In their example, they have:

    FacebookLoginManager.newSession((error, info) => {
      if (error) {
        this.setState({result: error});
      } else {
        this.setState({result: info});
      }
    });

If I'm reading the code right, I think the info object will contain a .tokenString property which you would then pass to ref.authWithOAuthToken() to authenticate to Firebase using that token.

Sorry I don't have a complete example to share, but hopefully this gets you going down the right track.

Holler if you have questions or get something working!

Best regards,
-Michael



--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/08381aa2-097d-44fb-9a2a-4820cba84e06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages