I'm creating an social application in which I have Sign-up from Facebook. Everything work fine. But recently from user Facebook profile URL I'm not getting its profile picture.
First this URL "https://graph.facebook.com/" + id + "/picture?type=large" work fine, but after few days getting profile picture like this:
After that I looked on internet and Found we need to add Access Token. Now the new URL is this String url = "https://graph.facebook.com/" + id + "/picture?type=large&access_token=" + getString(R.string.access_token); After that getting the exception from that URL.
{
"error": {
"message": "Error validating access token: The session is invalid because the user logged out.",
"type": "OAuthException",
"code": 190,
"error_subcode": 467,
"fbtrace_id": "Apk45eAb6DZG9oQGBd6vTmw"
}
}
Note: If still question is unclear, I would be glad if you add your contribution.
Found Solution:
You can just pass your app ID and app secret as the access_token parameter when you make a call:
curl -i -X GET "https://graph.facebook.com/{api-endpoint}&access_token={your-app_id}|{your-app_secret}"
Source: https://developers.facebook.com/docs/facebook-login/access-tokens
Related
https://api.twitter.com/1.1/account_activity/all/prod/webhooks.json?url=https://test.com not working
I have followed all steps to create a new application and getting consumer key, secret keys and also token details and try to create webhook via postman. I am getting follwing error
{
"errors": [
{
"code": 32,
"message": "Could not authenticate you."
}
]
}
I have tried delete and get methods for webhook and it is working fine.
They probably goofed in their example. You just need to move the url parameter from the query string to the form data. Use the x-www-form-urlencoded body.
Also - if you leave the nonce and timestamp blank, then Postman will auto-generate them for you.
enter image description here
I login in my ionic2 app in facebook and get response like this:
{
token: "iuiouoi.weewe.weioioioi", // this is example token
signup: "false"
}
And can get user id.
Then I want store user id in my database and send this token and user id to the server. I want check token and user id on server and make this request:
https://graph.facebook.com/me?access_token=iuiouoi.weewe.weioioioi
But after this request I have exeption:
{
"error": {
"message": "Bad signature",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "Bg4sWambfPx"
}
}
Can I check user id and this token for complience in my server, after login in application?
As per my understanding please read:-
Facebook Graph API giving an unknown OAuthException
"message": "An unknown error has occurred.", "type": "OAuthException", facebook sdk 4 php
If these also not work than read this link because its also a bug in FB.
https://developers.facebook.com/bugs/486654544831076/
I downloaded the example:
https://dev.office.com/Getting-Started/office365Apis?platform=option-android#register-app
clicking on send button throws this error:
RetrofitError: 404 Not Found
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Bearer access token is empty.",
"innerError": {
"request-id": "951626d4-0168-4b58-a78a-1fdd3bd322f2",
"date": "2016-04-29T18:34:05"
}
}
}
It looks like perhaps you did not register your app before downloading the sample. The readme instruction in the sample should walk you through registering and configuring an app, at which point the login should succeed and you will get a bearer token.
You are missing an access token. From https://msdn.microsoft.com/en-us/office/office365/api/discovery-service-rest-operations:
Discovery Service operations
Initial sign in
This brings the client to a web page where the user enters account information. It returns the endpoints needed to continue with Discovery Service. This is used the first time a user tries your application. It tells your application:
what cloud the user belongs to
where the app can send the user to log in
where to go to get a token
you can continue reading it on the official site.
I'm trying to get the access token for Facebook login, but got an error instead. All the answers that I found tell me about the wrong redirect_uri format.
This is the error I got:
{
"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": "Ht12b5BKgRK"
}
}
And here is the redirect URI registered in Facebook App.
Steps that I do:
https://graph.facebook.com/oauth/authorize?client_id=APP_ID&redirect_uri=http://127.0.0.1:8080/MyProject/Mapping&scope=user_posts&response_type=code
This link redirect me to http://127.0.0.1:8080/MyProject/Mapping?code=GENERATED_CODE
Then in the code i generate next URI:
https://graph.facebook.com/oauth/access_token?client_id=549422435210997&redirect_uri=http://127.0.0.1:8080/MyProject/Mapping&client_secret=CLIENT_SECRET&code=GENERATED_CODE
Requesting this URI gives me error instead of access_token
I have tryied also redirect_uri=http://127.0.0.1:8080/MyProject/Mapping/. Still no results.
Also, I have tied the same steps using restFB library for Java. And got the same error.
ScopeBuilder scopeBuilder = new ScopeBuilder();
scopeBuilder.addPermission(UserDataPermissions.USER_POSTS);
FacebookClient client = new DefaultFacebookClient(Version.LATEST);
String loginDialogUrlString = client.getLoginDialogUrl(APP_ID, "http://127.0.0.1:8080/MyProject/Mapping", scopeBuilder);
System.out.println(loginDialogUrlString);
System.out.println();
AccessToken appAccessToken = client.obtainAppAccessToken(APP_ID, APP_SECRET);
System.out.println(appAccessToken.getAccessToken());
System.out.println(appAccessToken.getTokenType());
//On this step i got the same error
AccessToken userAccessToken = client.obtainUserAccessToken(APP_ID, APP_SECRET, "http://127.0.0.1:8080/MyProject/Mapping/", appAccessToken.getAccessToken());
System.out.println(userAccessToken.getAccessToken());
The one thing that bit me when I did this is to make sure that the redirect_uri is URL encoded. In Java my code did something like:
import java.net.URLEncoder;
URLEncoder.encode("http://127.0.0.1:8080/MyProject/Mapping", "UTF-8")
for my redirect URL. Don't encode the entire URL, just the portion that is your redirect_uri.
I followed an instruction fro a user here, about allowing users to automatically login using their facebook account in the app that i am creating . But, i am having errors.
<%
String fbURL = "http://www.facebook.com/dialog/oauth?client_id=651066068265632&
redirect_uri=" + URLEncoder.encode("651066068265632") + "&scope=email";
%>
this is the new error that I got:
The redirect_uri URL must be absolute
also:
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
I tried to get a new example from Graph API, and i downloaded the whole project, but this is the error i am getting::
{
"error": {
"message": "Invalid redirect_uri: Given URL is not allowed by the Application configuration.",
"type": "OAuthException",
"code": 191
}
}
what should i do?
Please use the instructions on https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/ or use already existing interfaces like RestFB or Spring (https://spring.io/guides/gs/accessing-facebook/)