Base solution for your next web application
Open Closed

How to enable social logins (Facebook/Google) when developing our own mobile app using React native? #9208


User avatar
0
andry3ag created

Hello,

I notice that ASP.NET Zero supports some Social Logins and I can see how to enable those using the Angular application. However, is it possible to do the same thing if we develop our own mobile app using React native? What would be the proper way to enable social logins on a mobile web app?


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @andry3ag

    Your should implement it your self o nyour mobile app. Social Login flow for angular app works like this;

    1. App redirects (or opens a popup in some cases) user to login provider website
    2. User logins on external website
    3. User is redirected back to AspNet Zero Angular app with a token
    4. Angular app sends this token to server app
    5. Server app validates token by communicating with login provider
    6. Server app creates a local user entity if this is the first login
    7. Server app returns AspNet Zero token to Angular app

    In your case, you must implement steps 1-4, AspNet Zero server app will handle other steps. You can search for libraries for React Native to do this.

  • User Avatar
    0
    andry3ag created

    Hi @ismcagdas,

    For step 5 that you explained, is the end point on ASP.NET Zero /api/TokenAuth/ExternalAuthenticate? We have setup the social logins for the three apps below and this this what it returns

    Facebook returns: id,email,image,name,first_name,last_name

    Twitter returns: {"authToken","authTokenSecret","email","name", "userID", "userName"}

    Google returns: {"email", "first_name","id", "image", "last_name", "name"}

    Seems only one returns a authToken. Just wanted to make sure that is the only end point the front end needs to hit for getting AspNet Zero token

    Thanks agian for your time

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    For step 5 that you explained, is the end point on ASP.NET Zero /api/TokenAuth/ExternalAuthenticate? We have setup the social logins for the three apps below and this this what it returns

    Yes, correct.

    Maybe you should configure your apps on Facebook and Google sides. When I check the source code, both providers must return an access token. You can try to run them via AspNet Zero's web interface and see if they return token or not.