Google Admin Console use old page token with new auth token - google-oauth

I am accessing Google Directory API to list all ChromeOS devices with maxResults set to 100 and pageToken to fetch the next page. Once the token expires, I refresh the token and try to continue with the page where i was stopped previously using old page token. I get 400 error code.
Can any one let me know how can i resume to fetch the results once the token is renewed?
https://developers.google.com/admin-sdk/directory/v1/reference/chromeosdevices/list is the API

Related

How to refresh access token. Without opening graph API explorer ? In facebook GraphAPI

According to https://developers.facebook.com/docs/instagram-basic-display-api/reference/refresh_access_token/ , to refresh a long term access token , which you can get from user access token.
I am calling GET request on URL
https://graph.instagram.com/refresh_access_token
?grant_type=ig_refresh_token
&access_token={long-lived-access-token}
It returns
Sorry, this content isn't available right now
Is there any other way by which I can refresh access_tokens automatically by calling GET requests on URLs.
If you are already have the Long-lived access token then you can't refresh it manually
When user login using facebook login button what you get is a short lived access token you use this endpoint to get a long lived access token
curl -i -X GET "https://graph.facebook.com/{graph-api-version}/oauth/access_token?
grant_type=fb_exchange_token&
client_id={app-id}&
client_secret={app-secret}&
fb_exchange_token={your-access-token}"
after you got the long lived token it's will refresh once per day automatically if the user is using your app means the token is being used, if the token is not being used after 60 days the user must go through the login flow again in order to get a new token read more here

Authentication of the request failed. GoogleAdsapis POSTMAN call

I am using google ads api, I have generated Access Token, Refresh Token, I have CustomerId of my Ads Manager account, my developer token still getting this error. **My ultimate goal is to generate Keyword ideas using google ads api **
You have to put your generated token inside your request-header. With that token inside the header, every request to your API is authorized.
You can see that you have an "Authorization"-Token with the empty value "Bearer". There you have to put in your token, that your API can check the token and validate it. Same thing with the developer-token. Your requests sends empty header values.

Exchanging code for access token fails when using Sign in with Google in Dropbox

We have an application that uses Dropbox API. When the user goes through the Dropbox OAuth 2 flow and signs-in using their email address and password, all works fine and we get the access_token. However, when the user uses the "Sign in with Google" flow in the Dropbox authorization dialog, we get back code which we then try to exchange for access token but the request fails with {"error_description": "code doesn't exist or has expired", "error": "invalid_grant"}.
Here's the steps we use:
1.
var dbx = new Dropbox.Dropbox({ clientId: clientId });
var authUrl = dbx.getAuthenticationUrl('https://www.dropbox.com/1/oauth2/redirect_receiver');
This gives us url https://www.dropbox.com/oauth2/authorize?response_type=token&client_id=...&redirect_uri=https://www.dropbox.com/1/oauth2/redirect_receiver.
2.
Open authUrl in a popup.
3.
User uses "Sign in with Google"
4.
We get a redirect to the URL below that contains the code:
https://www.dropbox.com/google/authcallback?state=...&code=...&scope=...
Now trying to exchange the code for access token with POST to https://api.dropboxapi.com/oauth2/token gives us:
{"error_description": "code doesn't exist or has expired", "error": "invalid_grant"}
The problem here is that, given the use of the Google Sign In flow, there are actually two OAuth authorization flow instances occurring; the Google Sign In flow is nested inside the Dropbox app authorization flow. Your app doesn't actually need to know about this though.
That https://www.dropbox.com/google/authcallback URL is Dropbox's redirect URL for the Google Sign In flow, and accordingly the code given there is for the Google OAuth flow, not the Dropbox OAuth flow. Attempting to use it for the Dropbox OAuth 2 flow will accordingly fail as you've seen (since it actually came from Google, not Dropbox).
You should have your app wait until your own redirect URL (in your shared code, https://www.dropbox.com/1/oauth2/redirect_receiver) is accessed, and only then take the code from there and exchange it for a Dropbox access token.

Facebook graph api get the user's infomation

I want to make a website which users can see their posted pictures on the page.
I have signed up for facebook API and have an app id and app secret.
https://graph.facebook.com/oauth/access_token?client_id={#}&client_secret={#}&grant_type=client_credentials
I send users to the oauth to get the user's access token but I don't know what to do next.
https://graph.facebook.com/v3.0/me?fields=id,name,posts&access_token={#}
I thought this would work but I had the error below
"An active access token must be used to query information about the current user.",
The URL you are using to get the Access Token is actually an App Token API.
To generate the Access Token Please replace
https://graph.facebook.com/oauth/access_token?client_id={#}&client_secret={#}&grant_type=client_credentials
with
https://www.facebook.com/v3.0/dialog/oauth?response_type=token&client_id={#id}&redirect_uri={#}&scope=publish_pages
add a redirection url here where the token is published.
OR
better option is to use the login button mentioned here.
https://developers.facebook.com/docs/facebook-login/web/login-button
Also you can read here about all Access Tokens
https://developers.facebook.com/docs/facebook-login/access-tokens/

Onedrive new api, Resumable item upload fail when token expires

I have a problem with "Resumable item upload" (http://onedrive.github.io/items/upload_large_files.htm).
If the access token expires during the upload session I receive a 401 Unhautorized error even if I use the refresh token to obtnain another access token.
You are supposed to handle this in your application - refresh token if this happens and then continue uploading. Current chunk should be properly saved so you can continue with the next one.