3

Recently i started with a Twitter Integration.

The callback is working as it should. Login_Twitter

but when i press the Authorize App i keep receiving this error.

unable to process request due to missing initial state. this may happen if browser sessionstorage is inaccesible or accidentally cleared

Error_Login

This is the function where i call the twitter_login.

@override
  Future<FbUser> signInWithTwitter(
      Function(AuthException) exceptionCallback) async {
    var me;
    final twitterLogin = TwitterLogin(
        apiKey: 'xxxxxxxxx',
        apiSecretKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
        redirectURI: 'https://volado-app.firebaseapp.com/__/auth/handler');
    // Trigger the sign-in flow
    try {
      final authResult = await twitterLogin.login();
      switch (authResult.status) {
        case TwitterLoginStatus.loggedIn:
          final twitterAuthProvider = TwitterAuthProvider.credential(
              accessToken: authResult.authToken,
              secret: authResult.authTokenSecret);
          final userCredential = await FirebaseAuth.instance
              .signInWithCredential(twitterAuthProvider);
          return userFromFirebase(userCredential.user);
          break;
        case TwitterLoginStatus.cancelledByUser:
          exceptionCallback(AuthException(
              code: authResult.status.toString(),
              message: 'login canceled by user'));
          break;
        case TwitterLoginStatus.error:
          print(authResult.errorMessage);
          exceptionCallback(AuthException(
              code: authResult.status.toString(), message: 'Error login'));
          break;
      }
    } catch (e) {
      exceptionCallback(
          AuthException(code: e.errorCode, message: 'Unknown error'));
    }
    return me;
    // Get the Logged In session
  }

on my AndroidManifest i have this inside my activity tag

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <!-- Accepts URIs that begin with "example://gizmos” -->
            <!-- Registered Callback URLs in TwitterApp -->
            <data android:host="volado-app.firebaseapp.com" /> <!-- host is option -->
        </intent-filter>

i search and the only thing almost close was this:

Angular FirebaseUI Auth via Twitter, GitHub, Microsoft Not Working

But the issue was for angular, and the url i don't see any problem of misspelling :(

1 Answer 1

5

After some hours trying to figure out the problem, i found that the issue was on the AndroidManifest.xml

Basically on the intent-filter, the scheme was missing, and i need to remove the https from the host and the function call. After that it work :)

            <intent-filter>
                <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"
                        android:host="volado-app.firebaseapp.com" />
            </intent-filter>
Sign up to request clarification or add additional context in comments.

1 Comment

where add these lines in AndroidManifest.xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.