Skip to content
Back

Better way to known if user is created with OAuth

  • 0
  • Flutter
  • Auth
Mingu
31 Dec, 2024, 15:38

I want to know if user is from Oauth for some function. Right now I'm using current session provider to know if user is created with OAuth or with email (which is not OAuth)

TypeScript
      Session session = await account.getSession(sessionId: 'current');
      if(session.provider == 'email') {
        _userIsOAuth = false;
      } else {
        _userIsOAuth = true;
      }
      if (kDebugMode) {
        print(session.provider);
        print("User is Oauth: $userIsOAuth");
      }

which so far, works. I just want to know if there are better way or Appwrite built-in to know. I checked the documents (OAuth2 docs) and don't see such thing.

TL;DR
To determine if a user is created with OAuth, developers can use the current session provider to check if the user is authenticated with email or OAuth. There isn't a specific Appwrite feature for this, but the current method is effective.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more