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

Error on authorize #4

Open
Wazted opened this issue Feb 18, 2021 · 1 comment
Open

Error on authorize #4

Wazted opened this issue Feb 18, 2021 · 1 comment
Assignees

Comments

@Wazted
Copy link

Wazted commented Feb 18, 2021

Hi, I'm getting this error:
flutter: An exception occurred during a sign-in attempt: FlutterAuthException({code: FlutterAuthExceptionCode.login, message: An unknown http error occurred, details: {code:: -1002, url: https://twitter.com/oauth/authorize}})

but my actual code is:

final auth = TwitterAuth(
    clientId: 'xxxx',
    clientSecret: 'xxxx',
    callbackUrl: 'xxxx://',
  );

  void _loginTW() async {
    try {
      final resp = await auth.login(context);
      print("Successfully logged in $resp");
       Future.delayed(const Duration(milliseconds: 500), () {
          Navigator.pushNamed(context, '/home', arguments: resp.token);
        });
    } on FlutterAuthException catch (e) {
      switch (e.code) {
        case FlutterAuthExceptionCode.cancelled:
          print('Sign-in process was cancelled by user: ${e.toString()}');
          break;
        case FlutterAuthExceptionCode.network:
          print('A network exception was thrown: ${e.toString()}');
          break;
        case FlutterAuthExceptionCode.login:
          print(
              'An exception occurred during a sign-in attempt: ${e.toString()}');
          break;
      };
    }

  }

Does it comes from my Twitter App or somewhere I can`t see ??

@helenaford
Copy link
Member

helenaford commented Feb 20, 2021

Hi, I've seen this before. I'd check that your callbackUrl is valid. The -1002 is an error related to the webview unable to load the page, I believe.

Also, if the url is https://twitter.com/oauth/authorize this hints that it's failed to get a request token.

Let me know if you managed to get to the bottom of this. And, I'll make a note this needs to be added on the docs.

@helenaford helenaford self-assigned this Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants