Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Telegram Authentication in FlutterWebAuth2 CANCELED #96

Open
2 tasks done
JEFFERSeX opened this issue Feb 2, 2024 · 0 comments
Open
2 tasks done

[Bug]: Telegram Authentication in FlutterWebAuth2 CANCELED #96

JEFFERSeX opened this issue Feb 2, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@JEFFERSeX
Copy link

Description

I am encountering an issue with Telegram authentication in my Flutter app using the FlutterWebAuth2 package. The authentication process seems to be failing, and I consistently receive the error PlatformException(CANCELED, User canceled login, null, null).

Minimal Reproduction

Steps to reproduce the behaviour:

  1. Use the following code:
    void _signIn() async {
      try {
        final result = await FlutterWebAuth2.authenticate(
          url: Uri(
            scheme: 'https',
            host: 'oauth.telegram.org',
            path: 'auth',
            queryParameters: {
              'bot_id': '**********',
              'origin': 'https://socialnayasvyaz.ru',
              'embed': '1',
              'request_access': 'write',
              'return_to': 'https://socialnayasvyaz.ru',
            },
          ).toString(),
          callbackUrlScheme: 'https',
        );
    
        print(result);
      } on PlatformException catch (e) {
        GetIt.I<Talker>().handle(e, null, 'Error during Telegram login');
      }
    }
  2. AndroidManifest:
    <activity
        android:name="com.linusu.flutter_web_auth_2.CallbackActivity"
        android:exported="true"
    >
        <intent-filter android:label="flutter_web_auth_2">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="https" />
            <data android:host="socialnayasvyaz.ru" />
        </intent-filter>
    </activity>

Exception or Error

PlatformException(CANCELED, User canceled login, null, null).

Expected Behaviour

The Telegram authentication should be successful, and the user should be redirected back to the specified callback URL.

Screenshots

No response

Additional context

No response

Device

Android emulator Pixel 3a API 34

OS

Android 14

Browser

Chrome

Flutter version

3.16.7

flutter_web_auth_2 version

3.1.1

Checklist

  • I have read and followed the entire troubleshooting guide and it has not provided the solution I need.
  • I have provided all the information I can.
@JEFFERSeX JEFFERSeX added the bug Something isn't working label Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants