Social authentication in Ionic app using ngCordova-oauth

I am using ngCordova-oauth for facebook and google registration. The app works fine, but it always uses inAppBrowser

to open webview and login. It does not detect that the user has already connected to the device.

how can this be achieved in an ionic / cordova app if the user has already logged into fb or google and then took the token and then open the webview every time and subscribe?

+3


source to share


1 answer


How I do it as follows

1 - first login with ngCordova-oauth

2 - Get authentication token

and save it using $ localStorage



3 - When the user opens the app next time, I submit authentication token

to the server and validate it (up to step 1)

4 - If valid authentication token

, skip registration and go to

5 - If user logs out

, I delete authentication token

, which will invalidate step 3 and force it to start again

+2


source







All Articles