Exchanging oauth2 authorization code with access token - microsoft-metro

In my metro application, I am using google drive apps to get the files from drive.
After I get the code, I am getting error 400 (Invalid request) while exchanging it with access token.
This is my POST request:
https://accounts.google.com/o/oauth2/token?client_id=59349429483.apps.googleusercontent.com&client_secret={DELETED_INTENTIONALLY}&code=4%2FY-rI6ye27Msho3mxmkT7cyDxWzDs&grant_type=authorization_code&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob
The response I am getting is:
Status: 400
Response: {
"error" : "invalid_request"
}
Could anyone please let me know the problem with my request? I am setting the request parameters exactly as per google's documentation.

Related

Authorization Display & video 360 API

I would like generate the token to google apis.
I'm using this url:
https://oauth2.googleapis.com/token
and the body is :
grant_type:authorization_code
client_id: ***********
client_secret:*********
code:code
and I got the resposne :
{
"error": "invalid_grant",
"error_description": "Malformed auth code."
}
Someone could help me to generate the token ?
I have gotten this error before and after trying out a few things, I figured it out. Can you try to add access_type: 'offline' to your request body?
Here is an example in Node JS: https://developers.google.com/identity/protocols/oauth2/web-server#node.js_7

Google Oauh2 Verification Invalid Argument

I'm trying to submit an application for a verification through the Google Console as it has opened from today.
I have verified the domain in question through Goofle Search Console, I have ensured that all the links are set(Policy, Terms of Usage etc), filled the form with information and explanation about the scopes rhat requires verification.
When I submit the form I get no response that it's submited but the response from Network in Developer tools I see it's 400 HTTP Status and I see the following error message:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
}
I have double checked my steps but still not able to resolve this, any information that you can provide would be great.
Adding Request:
https://clientauthconfig.clients6.google.com/v1/brands/ID/submitReview?alt=json&key=AIzaSysnipsnip0DjtiCwWBwQ1djDy741g
Above request is PUT, here is the body content
{"brandId":"ID","scopeRationale":"","additionalInfo":"","contactEmail":"contactmeialaddress#gmail.com","pendingScopes":["https://mail.google.com/","https://www.googleapis.com/auth/gmail.modify","https://www.googleapis.com/auth/gmail.compose","https://www.googleapis.com/auth/gmail.insert","https://www.googleapis.com/auth/gmail.readonly","https://www.googleapis.com/auth/contacts.readonly"],"category":[1,3,5],"scopeDetails":[{"apiGroup":1,"pendingScopes":["https://mail.google.com/","https://www.googleapis.com/auth/gmail.modify","https://www.googleapis.com/auth/gmail.compose","https://www.googleapis.com/auth/gmail.insert","https://www.googleapis.com/auth/gmail.readonly"],"scopeRationale":"Why we need access to this scope."},{"apiGroup":2,"pendingScopes":["https://www.googleapis.com/auth/contacts.readonly"],"scopeRationale":"Additional info why we need this."}]}

Facebook API error subcode 33

I have an app that gets leads from facebook after webhook request when leads fill out forms: Some pages are throwing this error:
{
"error": {
"message": "Unsupported get request. Object with ID '233332620530416' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "HIItB4mggfk"
},
"__debug__": {}
}
I cannot find the error subcode description in Facebooks API docs.
Check you access token at https://developers.facebook.com/tools/debug/accesstoken
Your app might be missing a needed permission scope.
Visit Business Settings > Users > System Users > Chose «Conversions API System User» > Add Assets. Add your Pixel with ID from your request to the list of assets System User can access.
I have had this issue a few times and the error led me to spend an hour or two combing the docs. The real issue for me each time has been malformed json in the request body (I'm using curl). Dumb I know, but in case a poor soul comes across this. Be sure to validate your json before you decide you query is wrong.
I got this error when adding access_token in post body, worked when adding parameters to url.
Success result using postman
Not success result using postman
Add your access token in the Authorization tab, then choose Oauth2.0 and add your access token on the right side. Please refer to the screenshot for the postman.Click here for the screenshot
I found the answer recently
Follow this steps using postman
https://graph.facebook.com/page-name/feed
headers:
Content-Type: application/x-www-form-urlencoded
Body:
message: "your message"
link:"your web link "
access_token:'Your access token '

I want to use Get /v1.2/products REST API of Uber in android

I want to use Uber in my app by using its Rest API, and when I hit the same from Postman and i will get the same error every time
{
"message": "No authentication provided.",
"code": "unauthorized"
}
after entering the same request as given sample on the Uber Developers Site. you can also check the same here:
this is the link
And I am attaching here the pic of my request.
here is the image
In your Authorization header, replace server_token with Token.
So your example header has:
Authorization:server_token SERVER_TOKEN
replace that with:
Authorization: Token SERVER_TOKEN

Can We Access Facebook Api Using Postman client

I want to access my full details using facebook api . I am using postman client for this and hit api as
URL : graph.facebook.com/v2.2/me
METHOD : GET
HEADER PARAMETER :
AccessToken : djbjd
AppID : dsdmds
AppSecret :sdkkd
Now I get response :
STATUS : 400 Bad Request and Response
"error": {
"message": "An active access token must be used to query information about the current user.",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "AQt0krgrd2U"
}
}
Can anyone tell me how I can hit facebook api using postman client .
You only need one GET parameter for this, the access_token parameter. It must be a valid User Token or Page Token.
You can also just try this in the browser directly: https://graph.facebook.com/me?access_token=xxx
I've been using Bearer Token to input the access token on Postman Client. The cool thing about it is you can add it to the folder and have every query inside the folder inherit it from the parent.
This lets me focus on the call and use each folder as an environment for calls related to the same object Page, App, Messenger and other tests