How can we identify if user is registered user or logged in user using Native SDK

After the successful sign-up or sign-in on iOS/Android, we get a callback from SDK with Credentials as method param. We have a use case to trigger registration success or login success event for both email/password and social login depending on user is a new or existing user. Is there a way to identify if the user is new or existing after the successful authentication using SDK?

  • Which SDK this is regarding:
    iOS and Android SDK

  • SDK Version:

  • Platform Version:

  • Code Snippets/Error Messages/Supporting Details/Screenshots:
    private fun loginWithBrowser() {
    // Setup the WebAuthProvider, using the custom scheme and scope.
    .withScope(“openid profile email read:current_user update:current_user_metadata”)

          // Launch the authentication passing the callback where the results will be received
          .start(this, object : Callback<Credentials, AuthenticationException> {
              override fun onFailure(exception: AuthenticationException) {
                  showSnackBar("Failure: ${exception.getCode()}")
              override fun onSuccess(credentials: Credentials) {
                  cachedCredentials = credentials
                  showSnackBar("Success: ${credentials.accessToken}")
                  Log.d("token", credentials.accessToken)


Hi there @adarsha.nayak !

You might be interested in utilizing the logins_count property of the event.stats object in a Post Login Action. You can add this as a custom claim to your users ID/Access token and act accordingly client side.

For example:

exports.onExecutePostLogin = async (event, api) => {
  const namespace = '';
     api.idToken.setCustomClaim(`${namespace}/login_count`, event.stats.logins_count);
     api.accessToken.setCustomClaim(`${namespace}/login_count`, event.stats.logins_count);

Hope this helps!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.