Closed Panagiss closed 2 years ago
@Panagiss I think it works.
There are some things I would like you to go over.
Projects & Apps > your app > app > User authentication settings > Edit
Both authToken and authTokenSecret are NULL.
Also yes, I have enabled OAuth 1
same error
I got the same error.
I made a PR because I fixed it. Can you see it?
@katsuyax @shivrajwalkeflutter @katsuyax 4.1.1 is now available. Could you please confirm the correction?
@0maru I confirmed that both API V1 and V2 can login and there is no problem with the status.
Still getting the same error. I have upgraded to 4.1.1 though. Any thoughts?
I/flutter (11990): TwitterLoginStatus.error I/flutter (11990): null (authResult.authToken) I/flutter (11990): null (authResult.authTokenSecret) I/flutter (11990): HttpException: Failed Forbidden
Please solve this problem. i am getting every time this error.
@0maru please update on this issue.
@Panagiss @sandeepunify
Please add callback url of example://
to Twitter Developer.
Then check if you can loggedIn with the twitter_login example project.
If the sample project works, please share your project with me via git or zip.
@sandeepunify Do not share the API KEY and API SECRET KEY. I recommend that you regenerate API KEY.
@0maru
Login Code:
_loginWithTwitter() async { final twitterLogin = TwitterLogin( // Consumer API keys apiKey: 'api_key', // Consumer API Secret keys apiSecretKey: 'api_secret_key', // Registered Callback URLs in TwitterApp // Android is a deeplink // iOS is a URLScheme redirectURI: 'ujjain://', ); final authResult = await twitterLogin.login(); print(authResult.status); print(authResult.authToken); print(authResult.authTokenSecret); print(authResult.errorMessage);
// switch (authResult.status) {
// case TwitterLoginStatus.loggedIn:
// // success
// break;
// case TwitterLoginStatus.cancelledByUser:
// // cancel
// break;
// case TwitterLoginStatus.error:
// // error
// break;
// }
}
twitter_login: 4.2.0 what should be use Type of App ? My app is hybrid Thanks
@katsuyax The code looks fine. Can we share a project at the minimum configuration that causes the error.
what should be use Type of App ?
Whichever you choose, it will work fine. Web App or Native App is recommended.
@0maru https://github.com/sandeepunify/twitter_login please check and let me know what is the issue
@0maru I think the cause is different from other people.
I tried with a native app. The error I got was that the code returned a string with the ID expecting an int. This is due to the difference in JSON returned by Twitter between V1 and V2. So my fix fixed it.
@sandeepunify Thanks.
It worked fine.
If running on an emulator, regenerate the emulator. If you are using a terminal, reboot it.
@0maru Thank for your reply At my side, I don't know why this is not working every time returning error. there can be problem of twitter app configuration settings?
@0maru Problem has fixed now after searching your code on github I replaced final authResult = await twitterLogin.login() to final authResult = await twitterLogin.loginV2(); now working fine. Thanx for support
@0maru @katsuyax That was the problem for me also.
When I used twitterLogin.loginV2()
it returned success !! I got another error where it stated that I only have essential access and not elevated access, but that's another thing which is different.
So yeah the fix was to switch to V2 method!
Here is the full error:
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: [firebase_auth/invalid-credential] The supplied auth credential is malformed or has expired. [ Failed to fetch resource from https://api.twitter.com/1.1/account/verify_credentials.json?include_email=true, http status: 403, http response: {"errors":[{"message":"You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal.
I made the application for Elavated privileges, BUT my question why don't you use the V2 API and get rid of the need to applu for Elevated access? Am I missing something?
Thanks
@Panagiss Twitter API v1.1 is not available when creating a new application in twitter developer from November 15, 2021. You must apply to be able to use v1 if you need the user's email address. This is a problem because Twitter does not provide api v1 to all users. Also, api v2 does not provide a way to retrieve a user's email address.
And flutterfire_ui does not support loginV2. You must either make flutterfire_ui loginV2 compliant, use twitter_login, or enable api v1.
While I have followed the guide step by step I cannot login on Firebase using Twitter. Here is my code:
AndroidManifest.xml:
And also I have included the updated callback in the Twitter Developer portal:
Lastly I have set the API key and Secret in the Firebase console and of course I have enabled Twitter sign in.
Twitter_login: ^4.1.0 but I have also tried with 4.0.1