Facebook OAuthException with 500 (error code 8) - ios

I'm working with the Facebook iOS SDK (version 15).
When logging in and returning to the app, the Facebook SDK keeps throwing this error
▿ Optional<Error>
- some : Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={NSRecoveryAttempter=<FBSDKTemporaryErrorRecoveryAttempter: 0x28219d100>, com.facebook.sdk:FBSDKGraphRequestErrorKey=1, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An unknown error has occurred., com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 1;
"fbtrace_id" = AK1LoNJP0ca0quThgMVlELr;
message = "An unknown error has occurred.";
type = OAuthException;
};
};
code = 500;
}, NSLocalizedRecoveryOptions=(
OK
), com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=500, NSLocalizedRecoverySuggestion=The server is temporarily busy, please try again., com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCodeKey=1}
Because of this, Facebook keeps blocking my app, so users cannot log in using Facebook.
Any ideas on what the cause of this could be?

Related

FBSDK OAuth error on Xcode, Swift - Graph API for app id "New App ID" called, but token has app id "old app ID"

Facebook OAuth error switching from one app ID to another
I worked with contract devs who created the iOS application on another Facebook app ID which i can't control. I am trying to switch it to mine but ran into an error that the token still is using the old App ID. I switched the AppID & the CFBundleURLSchemes in the Plist too. The app compiles with no errors & I am able to get through to FB OAuth but once I sign in, it doesn't go through.
This is the error that I'm receiving
2019-11-15 17:13:20.233275-0600 Imbue[28564:6158269] FBSDKLog: Failed to send AppEvents: Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=400, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=(#100) Graph API for app id 472586343541363 called, but token has app id 2470569892995934, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 100;
"fbtrace_id" = "AknZ_YjiTwxrvivhd6v2f_d";
message = "(#100) Graph API for app id 472586343541363 called, but token has app id 2470569892995934";
type = OAuthException;
};
};
code = 400;
(#100) Graph API for app id 472586343541363 called, but token has app id 2470569892995934,
This is the code I have for OAuth
#objc private func authenticateWithFacebook() {
LoginManager().logIn(permissions: ["email", "public_profile"], from: self) { [weak self] (result, err) in
guard let authResult = result else { self?.show(message: FailureMessage.Login.message); return }
if err != nil || authResult.isCancelled {
self?.show(message: FailureMessage.Login.message)
}else {
self?.presentProtectedPage()
}
}
}
I'm not sure what the issue is, have been wrestling with it all day & I feel like it's something super simple. Would appreciate your help as a newbie to swift.
Thanks!

linkAndRetrieveData not working with Facebook for Firebase Authentication in iOS

First I am calling -
FBSDKLoginManager().logIn(withReadPermissions: ["public_profile", "email"], from: self)
On success getting credential -
let credential = FacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)
Then passing the credential to linkAndRetrieveData -
Auth.auth().currentUser?.linkAndRetrieveData(with: credential)
Getting this error, which says “MISSING_ID_TOKEN” -
{
FIRAuthErrorUserInfoNameKey = "ERROR_INTERNAL_ERROR";
NSLocalizedDescription = "An internal error has occurred, print and inspect the error details for more information.";
NSUnderlyingError = "Error Domain=FIRAuthInternalErrorDomain Code=3 \"(null)\" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={\n code = 400;\n message = \"MISSING_ID_TOKEN\";\n status = \"INVALID_ARGUMENT\";\n}}";
"error_name" = "ERROR_INTERNAL_ERROR";
}
It works fine with -
Auth.auth().signInAndRetrieveData
What I am doing wrong here?
It should be fix soon with Firebase Authentication version 5.4.1. See the issue below:
https://github.com/firebase/firebase-ios-sdk/issues/2522

iOS error with Firebase Auth Sign In using Twitter credentials

I have a iOS Firebase app that supports Twitter login, but occasionally the signIn(with: credential call randomly fails and I can't figure out why.
First the user signs in with Twitter (which never fails), then I use the Twitter session to get the credentials, and then I use those credentials to sign in with Firebase which sometimes fails.
Here's the complete code
func twitterLogin(_ done:#escaping (_ user: FIRUser?, _ err: Error?) -> Void) {
Twitter.sharedInstance().logIn() { session, error in
guard error == nil else {
done(nil, error)
return
}
let credential = FIRTwitterAuthProvider.credential(withToken: session!.authToken, secret: session!.authTokenSecret)
FIRAuth.auth()?.signIn(with: credential, completion: { (signUser, error) in
//User is signed in
// ERROR OCCURS HERE. ANY HELP WOULD BE GREATLY APPRECIATED
done(signUser, error)
})
}
}
Here's the exact error message I'm getting.
UserInfo={NSUnderlyingError=0x600000442c10 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={
code = 400;
errors = (
{
domain = global;
message = "Network error while to fetch VERIFY_CREDENTIAL from TWITTER.";
reason = invalid;
}
);
message = "Network error while to fetch VERIFY_CREDENTIAL from TWITTER.";
}}}, error_name=ERROR_INTERNAL_ERROR, NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information.})
I've tried to specifically search for the error message I'm getting "Network error while to fetch VERIFY_CREDENTIAL from TWITTER." but I can't find any solution. I found some posts which I believe were in Japanese but I couldn't understand their solution.
I even looked at Firebases iOS Auth errors here
https://firebase.google.com/docs/auth/ios/errors
but the error key FIRAuthErrorUserInfoDeserializedResponseKey isn't even listed as a possible error for signInWithCredential:completion:
I'm seeing the same error. Example at codepen:
https://codepen.io/mosse/pen/KmGMap
<button class="login">login</button>
<script src="https://www.gstatic.com/firebasejs/4.0.0/firebase.js"></script>
<script>
var config = {
apiKey: "AIzaSyDfJ5KuDofcZpahzl4H3XTl4f6R65gUyrQ",
authDomain: "authtest-3a944.firebaseapp.com",
projectId: "authtest-3a944",
};
firebase.initializeApp(config);
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".login").click(function(){
var providerObj = new firebase.auth.TwitterAuthProvider();
firebase.auth().signInWithPopup(providerObj)
.then(result => {
console.log('success')
console.log(result.user)
})
.catch( err => {
console.log('failure')
console.log(err.message)
})
});
});
</script>
Firebase support suggest the cause is due to an unreliable Twitter endpoint, but haven't suggested any solution.
An older project using Firebase 2.3.2 does not replicate the error, which suggests that there should be a Firebase solution to me.

Why I can't streaming a live video from iOS app to Facebook?

I want to stream a live video from my iOS app in my news feed on Facebook. I have this permission for that: publish_actions and user_videos, according with FB documentation:https://developers.facebook.com/docs/videos/live-video-api. But when I use other accounts to login (not the one on which my application registered), I keep getting this error:
Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=100, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 100;
"fbtrace_id" = "Dx9+pqUfSB5";
message = "(#100) No permission to perform current operation.";
type = OAuthException;
};
};
code = 400;
Please help me solving this problem. Thanks in advance!

Error code 403 when using guest authentication with TwitterKit iOS for getting user timeline

I am using Fabric's twitter kit for getting a username's tweets in my iOS application by making a request to the REST API endpoint "https://api.twitter.com/1.1/statuses/user_timeline.json"
I am have correctly set up my "consumer key" and "consumer secret key" as provided by the Fabric app in my AppDelegate and info.plist , but I repeatedly get the following error message -
Error: Optional(Error Domain=TwitterAPIErrorDomain Code=200 "Request
failed: forbidden (403)"
UserInfo={NSErrorFailingURLKey=https://api.twitter.com/1.1/guest/activate.json,
NSLocalizedDescription=Request failed: forbidden (403),
NSLocalizedFailureReason=Twitter API error : Forbidden. (code 200)})
My code is as under follows -
Twitter.sharedInstance().startWithConsumerKey(TWITTER_CONSUMER_KEY, consumerSecret: TWITTER_CONSUMER_KEY_SECRET)
Fabric.with([Twitter.sharedInstance()])
let userId = Twitter.sharedInstance().sessionStore.session()?.userID
let client = TWTRAPIClient.init(userID: userId)
let params = ["screen_name": twitterUsername, "count" : "10"]
var clientError : NSError?
let request = client.URLRequestWithMethod("GET", URL: TWITTER_TIMELINE_ENDPOINT, parameters: params, error: &clientError)
client.sendTwitterRequest(request) { (response, data, connectionError) -> Void in
if(connectionError == nil) {
self.twitterJson = self.nsdataToJSON(data!)!
self.constructTweetView(self.twitterJson)
}
else {
print("Error: \(connectionError)")
}
I am on the most recent version of TwitterKit(>2.0)
How can I go about resolving this ?
Thanks!
Add key in exception domains as shown in info.plist. Following fixed bug for me.

Resources