I create an ACAccountStore
, get access to the user's facebook account, store the account in an ACAccount
object, and am able to retrieve the token from the credentials. But when I try and use this token to retrieve information from Facebook it won't authenticate, and attempting to renew the credentials using renewCredentialsForAccount
will just yield a response of ACAccountCredentialRenewResultRejected
.
I can't get the permission pop-up to show up again to request permission by any easy means either. The only way I can get it to request permission once more is to either change the permissions I'm asking for in the app, or to delete and re-add my facebook account in settings.
How to I go about getting a valid auth token at this point?
Since there is no accepted answer I try to reply what I found. After my comment above I read the documentation about renewCredentialsForAccount which says "If the user has deauthorized your app, this renewal request will return ACAccountCredentialRenewResultRejected."
What is missleading that it is not the user who rejects but Facebook.
I think I understand the concept now and I try to reply to those who failed with this issue like me. In fact what I did not realise is that my FB token will be completely reset when I receive ACAccountCredentialRenewResultRejected result. And that is the key element in the puzzle.
So what you need to do for different results:
This is what I came up with. It is a very nasty API which has a poor documentation and missing samples. Also the examples around the Internet are about the "Success" and they do not care about the fact that the user can revoke permissions outside the app. I am in a constant try & fail development mode. Loosing gray hair but coming to the end. I hope my response helps others.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With