I am trying to request the authtoken for my app via the Facebook API Graph Exlorer following the facebooks instructions. When I do a get call with a URL with the following form:
https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials
I get the following error:
{
"error": {
"message": "Invalid callback",
"type": "OAuthException",
"code": 1
}
}
Suggestions on how I might go about obtaining the access token for my app would be greatly appreciated!
If I try to obtain the access code programmatically running the following code:
FB.api('/oauth/access_token?client_id={APP_ID}&client_secret={APP_SECRET}&grant_type=client_credentials', function(response) {
alert(JSON.stringify(response));
});
I get the following error:
{"error":"load-error: unknown"}
You cannot execute this command using the Facebook Graph API explorer.
Typing it directly into the browser returns the access token as desired.
Related
I am trying to call Microsoft graph Api via Postman to get users. Before calling the query, it is asking for token.
So I first generated token by giving parameters like below:
https://login.microsoftonline.com/mytenantid/oauth2/v2.0/token
client_id='myclientid'
&scope=https://graph.microsoft.com/user.read
&grant_type=client_credentials
&client_secret='appclientsecret'
This generated the access token successfully. But when I am using this token to call Microsoft Graph Api it is giving me the below error:
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "CompactToken parsing failed with error code: 80049217",
"innerError": {
"date": "2022-05-15T14:08:00",
"request-id": "d0199a29-7223-47e9-add6-20d47ae9d5af",
"client-request-id": "d0199a29-7223-47e9-add6-20d47ae9d5af"
}
}
}
Can anyone help me to solve this error.
Please check if you have generated the token by giving below API permissions:
After generating the token, decode the token via JSON Web Tokens - jwt.io and check the aud claim like below:
I tried in my environment and was able to call Microsoft graph api via Postman successfully like below:
In authorization tag select type as bearer token and enter the access token value in token field.
I'm testing OAuth 2.0 with facebook API, after receiving the authorization code and requesting the access token with the GET https://graph.facebook.com/v3.3/oauth/access_token? i got this response :
{
"error": {
"message": "Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "Dl3lYjJLKKy"
}
}
the redirect_uri is the same as the one in the login dialog since i'm just testing on localhost.
Everything was working fine till today,i even tested new callback url using localtunnel but it didn't work at all
Pretty straightforward: I'm trying to get Facebook ads attribution data for my Android app using Open Graph API (so I can detect which users came from Facebook ads, which ad, etc). When I use the below url, I get the following error:
{ "error": {
"message": "(#100) Tried accessing nonexisting field (activities) on node type (Application)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "H4b8LYlSGeN" } }
https://graph.facebook.com/{app_id}/activities?access_token={token}&event=MOBILE_APP_INSTALL&attribution={attribution_id}
I got the method via this page in their documentation, which does appear to indicate it works the way I expect.
Am I missing something here? Am I using a totally wrong method to get attribution data?
I was making a GET request rather than a POST because I'm a dumdum
We're building a site using Ember for a frontend app which interacts with our Django Rest Framework API Backend. For Social Authentication we're using django_rest_auth coupled with django-allauth. The site is mostly all working, except we've run into problems with social authentication. Our local account authentication/registration is working fine.
I've made many projects that use django-allauth, but this is the first time using a restful authentication system. The ember application is able to go and fetch the token from google just fine. The response is something like:
{
authorizationCode: "mYtokEn12345",
provider: "google-oauth2",
redirectUri: "http://localhost:4200/dashboard"
}
I then post the access_token to my endpoint that I've set up according to the django_rest_auth docs. POST /auth/google {access_token:} but I get an error returned from Google that says "Invalid Credentials". How can I get Invalid Credentials after already Authenticating with Google and receiving my token?
After debugging through the code, I found that I was getting that response from https://www.googleapis.com/oauth2/v1/userinfo during the complete_login function in the allauth.socialaccount.providers.google.views.GoogleOAuth2Adapter class.
It's trying to run a GET https://www.googleapis.com/oauth2/v1/userinfo?access_token=mYtokEn12345&alt=json but returning Invalid Credentials.
{
error: {
errors: [
{
domain: "global",
reason: "authError",
message: "Invalid Credentials",
locationType: "header",
location: "Authorization"
}
],
code: 401,
message: "Invalid Credentials"
}
}
I'm pretty stumped on where to go from here. Anyone have some pointers on why this is happening? Any other code/errors I can give to be helpful?
It turned out that we weren't using the correct token. We were using the authorizationCode, which is used in another request to receive the token.
I'm using the Facebook Graph API to reply a direct message.
I have published my message issuing an HTTP POST request to /CONVERSATION_ID/messages with a valid access token.
But I receive the following error:
{
"error": {
"message": "(#3) Unknown method",
"type": "OAuthException",
"code": 3
}
}
The same test on the Graph API Explorer returned the same error.
Can anyone please help me out?
My Workplace (Facebook for business) GRAPH API application received a "(#3) Unknown method" error when it didn't have POST or DELETE permissions for the action it was attempting. Changing the integration/application permissions resolved the problem for me.
You don't need to add /messages to the API. Just call the API as https://graph.facebook.com/{message_id} to get the thread.