Issue while refreshing token generated from Aadtokenprovider - azure-active-directory

I am using Aadtokenprovider in my spfx bot extension for generating token. After token get expired bot show error 'Unable to connect'. How do I refresh token and pass it .

There is an open issue with Microsoft for this problem. github.com/SharePoint/sp-dev-docs/issues/4892

Related

How to solve this LinkedIn API error "Not enough permissions to access: GET /me",

I am using this url "https://api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))" for getting the user name and user image, but I am getting an error response.
This is the response I'm getting:
I am using React Linked In Login Using OAuth 2.0 package.

Sign in with Linkedin not working (giving issue's of invalid access token and blocked by CORS Origin)

As I'm trying to integrate Linkedin API to get user's email to make a social sign in functionality in my project. Currently my project is working in react.js as frontend and node.js as backend.
I'm working in 'localhost:3000'.
For that I have created a App in Linked Developers section. From that I got my 'Client id' and 'Client Secret' key. And I also selected sign in with linkedin in products. Then I have integrated one package for react which helps me to sign with linkedin process. On clicking of that button it opens a popup which asks for linkedin signin. After that successfull sign in I get a code and state in response. When I enter that code for authorization it shows invalid access token. I tried to hit the API for authorization - "https://www.linkedin.com/oauth/v2/authorization. Then I hit the API - "https://api.linkedin.com/v2/me to get user profile but still getting the issue of "invalid access token".
I have read multiple documents and tried to integrate linkedin API in frontend as well as in backend too. But both side I'm getting error of CORS issue (Cross origin has blocked). or redirect_uri is not as per registered value. (I have entered multiple redirect_uri's in my linkedin app but none of them are working). or access token is not proper.
Please help me in this issue. I'm not getting why I'm having this error. What steps I have to follow Please guide me breifly.
I have tried to hit the API in multiple ways: postman, sample html file through AJAX, in react using its one of package, in php file using AJAX. But same issue in all.

Redirect When Access Token Expired OAuth2

Im using OAuth2 to secure my API, but i wouldn't use refresh token to get my new access token, im just want redirect to some pages when the access token is expired
Header Response Capture
I guess redirecting is easy, If your application is a server App then send the response back to browser with status 302 and LOCATION=redirect_URI?error_code=&error_desc=. You can build the error page to be JSP or even servlet which simply reads the error_code and error_description and displays it in friendly manner. Make sure that the error page is not protected by the filter which checks the token

Salesforce REST API getting an error 401

I am using REST API get information from Salesforce to my PHP page. After a long time don't use on PHP page I take a error message "failed with status 401, response [{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}], curl_error , curl_errno 0". Please help me how to recall Authentication on php to avoid session timeout? I want my Page is always connection to Salesforce. please tell me other suggestions to resolve it.
The session ID or OAuth token used has expired or is invalid. The response body contains the message and errorCode. - http://www.salesforce.com/us/developer/docs/api_rest/Content/errorcodes.htm
Just catch that 401 error and reauthenticate.
Or use the refreshToken when using Oauth. As documented here: http://wiki.developerforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com

Salesforce Refresh Token OAuth

I am trying to refresh the access token using the refresh token:
curl https://login.salesforce.com/services/oauth2/token -d "grant_type=refresh_token&client_id=3MVG9pHRjzOBdkd.WU9DLyfznP.sjOJRXXX_00nLDYSpM_0K7zAOsLrRKf6IWmCv6MxeTorXL7Zzaaea8IXXX&client_secret=3231123171523457&refresh_token=5Aep861VUUSqKxtr91VaZ7Zh54RmFqHE6zD4htOq6vY9edPgkgm9ZeFPwHIzQQvR__XypcEvWnXXX==&format=json"
But I keep getting the error "error_description":"expired access/refresh token"
Anyone have any idea?
I know this is old, but for people that may stumble on this.
I believe this issue is that you can only have 5 access grants per applications. After this it starts revoking refresh tokens from the oldest one. More info here:
Manage OAuth Access for Your Connected Apps
invalid_grant —expired access/refresh token | Issue #80
You have the correct syntax for using a refresh token. Make sure all of your parameters are URL encoded, since in your example your refresh token has = instead of %3D.
You can also delete the user's refresh token by going to that user's User Detail page inside of setup and revoking the "Remote Access" near the bottom. Then obtain a new refresh token by going through the oauth flow again and try it in the curl command.

Resources