Skip to content

🚀 Feature: Oauth2 does not automatically redirect in React Native? #35

Closed as not planned
@kunshksingh

Description

@kunshksingh

🔖 Feature description

moved from appwrite issue #8867

I wasn't sure if I should be putting this under bug report, enhancement, or documentation, but considering I'm newer to expo+appwrite+react native, I decided to put this under enhancement because this may be intentional.

The documentation of Oauth2 / google seems like account.createOAuth2Session(OAuthProvider.Google); should automatically open the login page for the Oauth2 provider.

Image

However upon trying this in code, it seems to give the URI. And on mobile, no browser window or redirect occurs - the same screen still displays.

export const googleLogin = async () => { // Add async here to handle the session creation
  try {
    console.log('Initiating Google login...');
    // Create the OAuth2 session URL
    const uri = await account.createOAuth2Session('google');
    console.log(uri);
    
  } catch (error) {
    console.error('Error during Google login:', error);
  }
};

Image

I tried both the appwrite and react-native-appwrite libraries, and both seem to have a similar effect.

🎤 Pitch

As a newer user of appwrite, this was super confusing. I thought the mobile application would redirect me or open a new window with the URI containing the Oauth2 provider's login portal just by invoking the createOAuth2Session method. This is not the case, even with any of the optional parameters.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions