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)
- ui user presses 'login facebook' button (provided facebook sdk android)
- ui user signs in facebook credentials
- client side gets user's access token facebook
- client side encrypts access token , passes server.
- server decrypts access token, , talks facebook graph api using access token - validating token, , if needed, getting additional info related requesting user.
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
Post a Comment