Facebook login returning "unauthorized"
I've been trying to hook up Facebook login via an iPhone app. I have set the FACEBOOK_APP_ID on my Heroku deploy and even echoing it out to the log so I know that is being set.
My iPhone app has all there correct information in the plist file.
For some reason though, when I go through the connect process using, PFFacebookUtils.logInInBackgroundWithReadPermissions, the app always returns:
unauthorized (Code: 0, Version: 1.12.0)
I'm not sure where to begin tracking this error down. I don't see anything in the log files either.
Any help would be greatly appreciated. Thank you.
Did you set the facebookAppIds in the parse-server? Related to #82
No, I haven't. Is that part of the
var api = new ParseServer({
...
});
Code? I didn't see that in the docs. IS that now the official way to do it and if so do i still need to set the env var FACEBOOK_APP_ID?
Thank you.
It is in the readme, you can pass in an array of facebook app ids: https://github.com/ParsePlatform/parse-server/blob/master/README.md
You no longer need to set the environment variable.
Let me know if you have any other issues!
I'm actually still seeing the issue. This is what my code looks like
var api = new ParseServer({
databaseURI: databaseUri ,
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || '...',
masterKey: process.env.MASTER_KEY || '...',
clientKey: '...',
javascriptKey: '...',
facebookAppIds: ['1677777875569507']
});
Is there something I'm missing with that?
I'm still experiencing the same issue with Facebook login.
var api = new ParseServer({
databaseURI : "...",
cloud : "...",
appId : "...",
masterKey : "...",
facebookAppIds : ["742406752547323"],
filesAdapter : new S3Adapter(
"...",
".../",
{
bucket : "...",
bucketPrefix : "files/",
directAccess : true
}
)
});
Figured out a why this was still not working. If I called Parse.setApplicationId and Parse.initializeWithConfiguration this error would still happen. Also note that if you use the local datastore, that needs to be set in the configuration block as well.
I'm not calling Parse.setApplicationId in my code it has been commented out since I migrated. I'm getting the following error.
Permission denied for this action. (Code: 101, Version: 1.12.0)
I believe there's a bug in 2.1.0 with the RestWrite.js -> facebook.js data path. The validateAppId function in facebook.js assumes a passing of the literal access_token (String) but what's actually passed is an authData structure within which lives a key called "access_token".. so facebook.js should actually be trying to append access_token.access_token to the graph request, and not just access_token. More appropriately, the access_token argument of facebook.js:validateAppId should be renamed to authData and subsequently authData.access_token for the string builder contained within. As it is for validateAuthData.
cc @flovilmart
@penultimate-labs you're definitely right! The validateAppId should match the mockFacebook() in the test suite.
@chuckurbis Can you share me how to fix this?
has this issue been resolved? On my iOS and Android still experiences this while JS app is working fine.
On iOs: Permission denied for this action." UserInfo={code=101, temporary=0, error=Permission denied for this action., NSLocalizedDescription=Permission denied for this action.})
Did you update to the latest version?
Yes I did. Now I'm using [email protected]
Then Permission denied for this action is a Class Level Permission error. Did you set any CLP on _User? Can you provide the logs your get when running in VERBOSE=1.
Also, what version of Parse/FBSDK are you running on iOS?
My CLP on _User

Btw, I'm doing test with VERBOSE=1, will update when ready.
This would be the addField permission that would block I believe. Can you try turning it ON an see if the request passes?
@flovilmart awesome! It works flawlessly. Thanks so much! Do you still need the log when running in VERBOSE=1?
I'd like to understand why it blocked you from linking the user, did you add extra fields to the user object before linking?
I do nothing on client side but I have the hook afterSave on _User on cloud code. I add some fields to new User only. But the weird thing is that I couldn't log in as a new user as well as existed user.