php - How to Refresh Outlook access_token?

676

Okay so I am getting Error invalid_token while creating contacts to Outlook I have read a lot of documentation but I couldn't able to resolve the issue

The Answers that I found but not working for me

I tried adding Scope offline_access to the login API. In that code value get refreshed and I am passing that refreshed code value to access_token API But I am getting same access_token

Also, I found that we can refresh access_token using refresh_token but in response, I am not getting any refresh_token.

So how would I refresh the access_token.

165

Answer

Solution:

Ok SO We Have to Pass the Following Parameter while Callingoauth2/v2.0/authorize API

&scope=
openid 
profile
email 
offline_access  /*----This Is Important For Getting Refresh-Token--*/
contacts.readwrite

Then Using Refresh Token You Can Call Below API

https://login.microsoftonline.com/common/oauth2/v2.0/token

with Grant Type

"grant_type"=>"refresh_token",

People are also looking for solutions to the problem: php - Ajax stuck at before send

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.