Google Sign in - Native Android

Do Frappe support Google sign in from native Android mobile app ?

@revant_one Can you please help me with some pointers ?

i think social network supported by frappe
https://frappe.io/docs/user/en/guides/deployment/how-to-enable-social-logins

Yes but not able to achieve via native Android app

There’s a lib to sign in/add account to your Android native app.

It supports single sign on by frappe to login to mobile app using the frappe account.

I.e. it stores tokens generated by frappe backend for verification. It does NOT store tokens generated by Google.

Thanks @revant_one .
We are using frappe token(OAuth2) currently for our android mobile app .
We wanted to extend to “Google Sign in” as well .
Do frappe has some API to authorize the token generated from google ?

Frappe does not store any tokens from third party providers.

Currently frappe only uses the token to verify user, log in and then forgets about the token.

You can cache the tokens and verify?

  • In get_info_via_oauth() from frappe/utils/oauth.py,
    you can get the access token response as text.
  • parse it into json and cache it.
  • additional data to be stored along with token for later query, provider and user
  • Cache it for the expiry period mentioned in token. generally { ... expires_in: 3600 }
  • Clear expired tokens from cache. Redis cache ideal.
  • verify the cached token for the given provider.

Optional: (keeps the login perpetual for the user)

  • every bearer token has refresh_token, it can be used to get new access_token,
  • on expiry the token can be refreshed and a new bearer token response can be cached in place of previous token.

source https://github.com/frappe/frappe/blob/develop/frappe/utils/oauth.py#L132
read more https://tools.ietf.org/html/rfc7662