I am new to FB apps and trying to get the accessToken for my website using JS. I have followed the steps given on the API docs, but I keep getting an
"error": {
"type": "OAuthException",
"message": "Error validating application."
}
I know that theres some issue with my implementation. Can someone please help me out.
If you can provide a link to a tutorial/code snippet that would be really great.
Since today there is a change in Facebook Graph API, the given access token is now URI-encoded, it may be this your problem, give a look here: http://forum.developers.facebook.net/viewtopic.php?pid=273730
Related
I am trying to integrate Youtube API into my project but to start working with it, I need to generate the access token. I searched the internet and found multiple articles that confused me a lot. I have seen various methods to generate it, but none of them works for me.
I also tried this npm library, but this gives me the following error:
code: 403,
errors: [
{
message: 'The request is not properly authorized.',
domain: 'youtube.activity',
reason: 'forbidden'
}
]
I am tired of searching more on this, so if anyone has any idea to get it, Please tell me. It will be a great help.
Did you try to follow the official documentation? There are clear steps on how to get access.
https://developers.google.com/youtube/v3/getting-started#before-you-start
I am building out an e-commerce site, with next.js and stripe checkout. I keep running into this error when I am going to checkout. I am using the use-shopping-cart package as well, and I'm starting to think it maybe causing the below response error from stripe-checkout
"error": {
"message": "Invalid API Key provided: undefined",
"type": "invalid_request_error"
}
}
What is super confusing is that the checkout session in created, along with the cart and payment intent (I know this to be true because I can verify this information thru the stripe dashboard). Currently the stripe dashboard does not indicate there is an error either.
Has anyone experienced this, and does anyone have any idea on how to fix it?
Thanks in advance!
the solution is ridiculously easy. I just needed to prefix my env variable with NEXT_PUBLIC_.
this is my first post so please go easy on me!
I am a beginning developer working with javascript and node.js. I am trying to make a basic request from a node js file to facebook's graph API. I have signed up for their developer service using my facebook account, and I have installed the node package for FB found here (https://www.npmjs.com/package/fb). It looks official enough.
Everything seems to be working, except I am getting a response to my GET request with a message saying my appsecret_proof is invalid.
Here is the code I am using (be advised the sensitive info is just keyboard mashing).
let https = require("https");
var FB = require('fb');
FB.options({
version: 'v2.11',
appId: 484592542348233,
appSecret: '389fa3ha3fukzf83a3r8a3f3aa3a3'
});
FB.setAccessToken('f8af89a3f98a3f89a3f87af8afnafmdasfasedfaskjefzev8zv9z390fz39fznabacbkcbalanaa3fla398fa3lfa3flka3flina3fk3anflka3fnalifn3laifnka3fnaelfafi3eifafnaifla3nfia3nfa3ifla');
console.log(FB.options());
FB.api('/me',
'GET',
{
"fields": "id,name"
},
function (res) {
if(!res || res.error) {
console.log(!res ? 'error occurred' : res.error);
return;
}
console.log(res);
console.log(res.id);
console.log(res.name);
}
);
The error I am getting reads:
{ message: 'Invalid appsecret_proof provided in the API argument',
type: 'GraphMethodException',
code: 100,
fbtrace_id: 'H3pDC0OPZdK' }
I have reset my appSecret and accessToken on the developer page and tried them immediately after resetting them. I get the same error, so I don't think that stale credentials are the issue. My
console.log(FB.options())
returns an appropriate looking object that also contains a long hash for appSecretProof as expected. I have also tried this code with a number of version numbers in the options (v2.4, v2.5, v2.11, and without any version key). Facebook's documentation on this strikes me as somewhat unclear. I think I should be using v2.5 of the SDK (which the node package is meant to mimic) and making requests to v2.11 of the graph API, but ??? In any case, that wouldn't seem to explain the issue I'm having. I get a perfectly good response that says my appSecretProof is invalid when I don't specify any version number at all.
The node package for fb should be generating this appSecretProof for me, and it looks like it is doing that. My other info and syntax all seem correct according to the package documentation. What am I missing here? Thank you all so much in advance.
looks like you have required the appsecret_proof for 2 factor authorization in the advance setting in your app.
Access tokens are portable. It's possible to take an access token generated on a client by Facebook's SDK, send it to a server and then make calls from that server on behalf of the client. An access token can also be stolen by malicious software on a person's computer or a man in the middle attack. Then that access token can be used from an entirely different system that's not the client and not your server, generating spam or stealing data.
You can prevent this by adding the appsecret_proof parameter to every API call from a server and enabling the setting to require proof on all calls. This prevents bad guys from making API calls with your access tokens from their servers. If you're using the official PHP SDK, the appsecret_proof parameter is automatically added.
Please refer the below url to generate the valid appsecret_proof,and add it to each api call
https://developers.facebook.com/docs/graph-api/securing-requests
I had to deal with the same issue while working with passport-facebook-token,
I finally released that the problem had nothing to have with the logic of my codebase or the app configuration.
I had this error just because I was adding intentionally an authorization Header to the request. so if you are using postman or some other http client just make sure that the request does not contain any authorization Header.
I created a website for my Students Organization.
On that website there is a page where I list all the people who helped organize our Activities. Theres a picture of every member there.
To get the images, I used their facebook profile pictures.
I used http://graph.facebook.com/USERNAME/picture?height=250&width=250
This code did work a few days ago, but now the images dont seem to load. I followed the url and got a JSON object:
{
"error": {
"message": "(#803) Cannot query users by their username (user.name)",
"type": "OAuthException",
"code": 803
}
}
So it seems to me that facebook might have changed their security... (after googling I found out about some changes in their API 2.0 but I didnt fully understand that..)
This link does still seem to work if you have the userID, but I'm unable to get that userID because of the same error message through graph.facebook.com...
Is there still a way to get facebook profile pictures of people on your website or did facebook totally block this off??
Any help is appreciated!
If you want to use the data, you'll need to implement Facebook Login for your website, where the users can give their permissions to your app to use their data.
The username field is no longer accessible with the Graph API v2.0. There are at least 5-10 questions on this on StackOverflow today.
Look at the docs:
https://developers.facebook.com/docs/apps/changelog#v2_0
I have practiced getting for access token by using Temboo on authorization Url and callback id. But after using this callback id get error like "A Server Error has occurred: The specified object doesn't exist or you don't have the necessary permissions to access it. The error occurred in the Expression (Get callback data) step.". I am not getting how approach this issue. Thank you.
I work for Temboo.
The best place to start with Foursquare OAuth is by watching the short screencast below that explains everything you need to know about how Temboo simplifies OAuth. The video discusses working with the Fitbit API, but once you know how that one works you'll be able to use the Foursquare API in exactly the same manner.
http://www.temboo.com/videos#oauthchoreos
Setup instructions for the Foursquare OAuth Choreos can also be found here:
https://temboo.com/library/Library/Foursquare/OAuth/
Hopefully this helps, but feel free to contact us via email (support AT temboo.com) if you have further questions - we're always happy to help.