loopbackjs - How integrate loopback third-party login for android -


my project includes web , android client. want combine google cross platform sign-in , loopback third-party login.

in scenario, never ask username , password. user uses google sign-in button authentication , authorization on both web , android app.

lets assume, it's first time logged in google sign-in through web site. in loopback third-party scenario, if not existing on db, creates account corresponded provider , external id. (in case provider google , external id unique google id). web, loopback-example-passport

so, assume above scenario android. click google sign-in button , loopback server able above things (as web)

is there built-in way in loopback this? if not, how can integrate scenario in loopback properly?

well it's little bit old question, i've encountered same issue on android, facebook third party login.

i didn't find trivial solution, after lot of struggle tried different approach: (change facebook google case)

  1. ui user presses 'login facebook' button (provided facebook sdk android)
  2. ui user signs in facebook credentials
  3. client side gets user's access token facebook
  4. client side encrypts access token , passes server.
  5. server decrypts access token, , talks facebook graph api using access token - validating token, , if needed, getting additional info related requesting user.
  6. assuming it's valid, server check's if user has local account (can checked email or id):

    6.1 if user doesn't have account, create new 1 facebook user id or email (loopback requires password random 1 can provided), assign our own unique userid , issue our auth ticket (user.createaccesstoken(ttl, callback)).

    6.2 else, continue assigning auth ticket user session


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -