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?
source to share
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
source to share