I'm building a small Facebook login library for OS X. This isn't because there are no SDKs out there, but because I'd like something native to Cocoa that can encapsulate the login process. I'v successfully requested an access token from the Facebook login URL. I use this string format to perform the login:
https://www.facebook.com/dialog/oauth?client_id=%@&redirect_uri=%@&response_type=token
For the redirect_uri
field I pass https://www.facebook.com/connect/login_success.html
as per the Facebook documentation. I take whatever that response is and parse the URL. I'll either get a token or a failure. The token seems to come back okay. The trouble is in the next step.
Immediately after receiving my token, I attempt to validate it. I use the "debug" endpoint, like so:
https://graph.facebook.com/debug_token?input_token=%@&access_token=%@
I pass my new token as the input_token
and this is where it gets sticky. I've tried passing my client token, but that causes the following error:
The operation couldn’t be completed. (Invalid OAuth access token. error 190.)`
If I pass my app ID | app secret
, I get a different error:
The operation couldn’t be completed. ((#100) You must provide an app access token or a user access token that is an owner or developer of the app error 100.)
I'm not sure what's happening here, or what to do. Can anyone point me in the right direction?