Getting Access Denied from LinkedIn -C# Web API implementation - linkedin-api

My Implementation leans on Owin.Security.Providers.LinkedIn
I am getting access denied error after getting the Authorization Code successfully from
https://www.linkedin.com/oauth/v2/authorization
The weird thing occurs when I take this Authorization Code into postman and try to get an access token
from here:
https://www.linkedin.com/oauth/v2/accessToken
This request from Postman responds successfully with the Access Token that I need.
Any ideas why this happens?

Related

Facebook Graph API Service Temporarily Unavailable Error

I am trying to connect a bot to Facebook messenger, using Facebook developer tools.
https://developers.facebook.com/
I've created the Facebook app, and it's sent me the webhook to my server. However, when trying to call the Graph API when sending a message back to the user, I receive the following error:
FacebookMessaging:400 : {
"error": {
"message": "(#2) Service temporarily unavailable",
"type": "OAuthException",
"is_transient": true,
"code": 2,
"fbtrace_id": "AIWsRyUmPFnySGwb1Rgl4P6"
}
}
POST API,
https://graph.facebook.com/v10.0/page-id/messages?access_token=token
JSON
{recipient:{id:"id"}, message:{ text:"message"}}
I suspect it could be because my app is unreleased, but I'm trying to test it beforehand. Is there any other explanation for this, or how are you suppose to test an app before releasing it?
The same code is working for an older Facebook app that is released.
The issue was that the API call was missing the access token. Stupid mistake, but unusual error for missing the access token.
I already try and reproduce this problem. May be you use wrong access_token in this case. When you want to send the message by page, use should use page access token instead of user access token
Check out the diff here: https://developers.facebook.com/docs/facebook-login/access-tokens/
And flow here for get page access token: https://developers.facebook.com/docs/facebook-login/access-tokens/#pagetokens
It is clearly return you the response with type as OAuthException. If you find this error type in facebook garph api error handling documentation. You can see the first line of error codes is OAuthException. Also it is written there the resolution of this type of error in what to do column is, If no subcode is present, the login status or access token has expired, been revoked, or is otherwise invalid. Get a new access token.
If a subcode is present, see the subcode.
Well it is nice to see you get the answer on your own.

facebook app access token mismatch error

I am trying to send notifications to users via facebook canvas app(SDK 5). My notification code
$response = $fb->post('/userID/notifications?access_token='."$appAccessToken".'&template="test template"&href="test htrf"');
But I am getting an error "Uncaught exception 'Facebook\Exceptions\FacebookSDKException' with message 'Access token mismatch. The access token provided in the FacebookRequest and the one provided in the URL or POST params do not match"
I have checked the app access token in graph api explorer and its working fine! I tried to reset the app secret but same error
graph api explorer have no problem with the app access token but when i try to paste the app access token it in my code it shows the error.
I have tried to make app access token by combining app_id|app_secret but no luck.
am i doing it wrong?
Thanks

Unsupported get request only when using app token

When requesting /703889222997557 via the Facebook Graph API, I am receiving the error "Unsupported get request." But this only occurs when using an app token. When I use the "standard token" you get when opening the Graph API Explorer, the request is successful. As soon as select an App in the Explorer and use the App Token, the request fails again.
Any ideas what the problem might be here?

Facebook Access Token is Expired using Facebook SDK PHP

I am trying to link my application to a facebook user account but every time I go through the process of retrieving their profile I get this error:
string(140) "{
"error":{
"message":"An active access token must be used to query information about the current user.",
"type":"OAuthException",
"code":2500
}
}"
The reason I am confused is that when I initially request an access_token from facebook it return a token for me.
string(56) "access_token={app_id}|{app_secret}"
Which I am then told is expired and I don't know why.....
I understand in order to get an access token you must follow a particular workflow.
Client Requests access and permissions via SDK and Login Dialog.
User Authenticates and approves permissions
Access token returned to client
Graph API calls with short-term access token (web) or long-term access token (native mobile)
Based on what I've seen in my code, I get to step 3 but step 4 fails because the token is said to be expired. Does anyone have any idea what I can do to fix this!?
I notice that for step 1 the login dialog is never shown but I still get an access code returned despite this. Could that be something to do with it? This is the way I perform step 1.
<a class="lists" href="https://graph.facebook.com/oauth/authorize?client_id=564083793722908&redirect_uri=<?=urlencode($facebook_callback_url)?>&scope=offline_access,publish_stream,status_update">Connect a Facebook account</a>
Step 2. never seems to occur
Step 3. An access token is returned though. See above.
Step 4. Fails with the above error of expiration.
Any advice?
You cannot request user information with an app access token. You need a usser access token to do that. Your Login process needs to adhere the docs at
https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.1#login
to get a user access token. Apparantly, this is not the case with your code.
Furthermore, you're only using permissions which are (long) deprecated. See
https://developers.facebook.com/docs/facebook-login/permissions/v2.1#adding
https://developers.facebook.com/docs/facebook-login/permissions/v2.1#reference

Facebook access token graph API call result in a bad request error

We have a Canvas Facebook App and for some time we get a strange error for some of the users that are trying to install (allow) our Facebook app. I mention this is happening only for some of the users and not for all! The error we are getting is "The remote server returned an error: (400) Bad Request." The graph API call we putted in a try catch block and this is what the logs says when I searched over them to see what went wrong. The graph API call is:
https://graph.facebook.com/oauth/access_token?client_id=XXX&redirect_uri=XXX&client_secret=XXX&code=code_received_from_facebook.
We received the code from Facebook and append it to the graph API call from above but it seems that for some users this is not working. Our redirect_uri parameters contains an URL to our Facebook App and contains also some parameters (example: http://apps.facebook.com/our_application_URL?cid=xxx&surveyid=xxx&messageid=xxx).
xxx = some values.
Did some of you confront with this kind of strange behavior? Working for some users but for other is not working? We are using the same code so nothing change between a successful installation and a unsuccessful installation.
Thank you for your help in advance!
Now that Facebook require SSL for applications your "redirect_uri" need to be https (i.e https://apps.facebook.com/myapp/), otherwhise you will get "Bad Request".
You probably got the error for only the users that had forced SSL but not the rest.