We are using Yammer Export API token to download Yammer Messages for one of our Microsoft application. From last one month, we are getting "(401) Unauthorized" error while trying to download Yammer Messages.
Could you please let us know, how to fix this error and renew Yammer API Token. Please find below error Message.
"System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.WebClient.DownloadFile(Uri address, String fileName) at System.Net.WebClient.DownloadFile(String address, String fileName) at ConsoleDownloadApplication.Program.<ExportAPICall>d__9.MoveNext() line 255"
Per this page of the Yammer developer docs https://developer.yammer.com/docs/api-requests, apps can ask for a new token when their old token for a user expires. More detail is provided on the page.
Related
hello i tried launching python gmail API on my localhost but this error prevent me from authorizing and collect user tokens
credential.json correct
Authorized redirect URIs empty
Authorized JavaScript origins empty
You can’t sign in because geko sent an invalid request. You can try again later, or contact the developer about this issue. Learn more about this error
If you are a developer of geko, see error details.
Error 400: redirect_uri_mismatch
I have an app that uses the Google Calendar API and I seem to have a corrupt/defunct access token and/or refresh token which is resulting in the following error:
Signet::AuthorizationError
Authorization failed. Server message: { "error": "invalid_grant", "error_description": "Bad Request" }
Code for the authorization:
client_id = Google::Auth::ClientId.new(CLIENT_ID, CLIENT_SECRET)
token_store = EncryptingTokenStore.new(TokenStore.new)
scope = "https://www.googleapis.com/auth/calendar"
authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store, callback_url)
authorizer.get_credentials(CALENDAR_ID)
On investigation the UserRefreshCredentials we get back from authorizer object has an expires_at date in the past (11/01/2021).
I deleted the offending refresh token that we have stored, revoked access via the google account settings, then reauthenticated the user account with the app to reapprove offline access to Google Calendar again. This did not give me a new access and refresh token as expected. The expires_at is still 11/01/2021. We have valid refresh tokens in storage but for some reason Google is still picking up the old details despite that refresh token no longer existing. So I need to find a way to refresh or overwrite the UserRefreshCredentials that the Google API is using.
Other steps I have tried:
I tried to refresh the token from within a production console with some methods that come with the ruby google client gem but this fails with the same invalid_grant/Bad request error that is at the root of this issue.
I also tried to refresh the token with a POST request to the oauth2 endpoint:
https://oauth2.googleapis.com/token?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&refresh_token=REFRESH_TOKEN&grant_type=refresh_token
but this also fails with the same invalid_grant/Bad request error.
If anyone can shed any light that would be much appreciated.
We are trying to access the SharePoint url of the attachments shared in the teams/channel chat and for the teams meeting recording.
We have used Oauth2 to retrieve the auth token and using Microsoft graph api to get the downloadable/public url for the same
making a GET request with token in the request header still returns 401 Unauthorised error
Although we are able to get the downloadable url if we use site-id , list-id and item-id in the GET request https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item}/driveitem
But these are not available when our message extension app is invoked from a message
Posting the Answer for better knowledge
Copying from #Saonti comments
Using Graph API explorer are you able to get the drive item with this API graph.microsoft.com/v1.0/sites/%7Bsite-id%7D/lists/… ? Or you are getting error?
We are using Zohocrm api v2 for getting currently logged in user. It works fine for most of the logins.
But we are getting 403 for one of the user account.
URL https://www.zohoapis.com/crm/v2/users?type=CurrentUser
HEADERS {Authorization=Zoho-oauthtoken 1000.786ecda99xxxx}
Response
{"code":"NO_PERMISSION","details":{"permissions":["Crm_Implied_Api_Access"]},"message":"permission
denied","status":"error"}
Response Code 403
Note: From the same zoho team other 2 users were able to login.
Please suggest.
Just adding the steps with which I tried in Postman. It works for me.
If at all any of the steps are different from yours, you could try these steps instead.
Add the client to get client secret
Generate auth token giving client id and secret (and scopes)
After this step, oauth permission request page will be shown, asking user to confirm access to Accounts User Profile and CRM users info. Both have to be accepted.
Use the latest generated token in postman
Execute API GET
I have been using the OAuth approach to upload,update and delete videos on YouTube. That all has been working fine until about February 12th where all of those processes stopped working. Now when I go to delete a YouTube video I get the following error:
"code": 403,
"message": "The video that you are trying to delete cannot be deleted. The request might not be properly authorized."
I know that the OAuth process is working because I can get the token and refresh the token if it has expired. I'm using the latest PHP library that Google have provided (installed using composer). And I can get information about a valid YouTube video by making the following call:
$videoId = "xxxxxxx"; //id of video on YouTube
$youtube->videos->listVideos("snippet", array('id' => $videoId));
But then the delete call gives that error above.
$youtube->videos->delete($videoId);
Since the listVideos works, that confirms that the client_id, secret key and token is correct. I also am setting the scopes to be the following
$client->setScopes(array('https://www.googleapis.com/auth/youtube',
'https://www.googleapis.com/auth/youtube.upload',
'https://www.googleapis.com/auth/youtubepartner'));
I also checked that the credentials and quotas set in the Google APIs are ok. I thought that maybe the quota had been reached but that doesn't appear to be the case. I did see an email from YouTube in early february saying that they have a new terms of service and a developer policies. I reviewed all that but nothing in there appears to point to the issue I am having?
Not sure what else to try?
Try to check my answer here in this SO question that focus on how to Refresh Token with the Google API.
Your error usually caused by:
When the token expires
The token’s scope (this is important)
If the token is invalid
If the token is invalid you can troubleshoot like this:
Remove the access token from your datastore or database.
Use the refresh token to acquire a new access token (if you are using a refresh token)
Try to make the API call again. If it works, you’re good! If not …
Check the access token against the tokenInfo API
If it’s still invalid, do a full reauth
Hope this helps!