microsoftgraph/php-connect-rest-sample

Refresh token is missing from access token generation.

Closed this issue · 4 comments

Hi there! Thanks for providing this PHP sample, it's really helpful.

I have debugged the oauth.php and realised that the refresh-token is not included within the $accessToken object.

How can one fetch a refresh token along with the other data?

Thanks in advance,

Alex

Hi @alextselegidis . Can you see if adding offline_access to the scopes in src\Constants.php returns the refresh token?

Yeah! This actually did the trick! Thank you very much!

I have one more question though: If I run my app locally everything works fine. If I make the same from my server I get the following error and the Microsoft user cannot be authorized:

The provided value for the input parameter  "redirect_uri " is not valid. The scope  "Calendars.ReadWrite" requires that the request must be sent over a secure connection using SSL.

Does this mean that I can only use Microsoft Graph from with an SSL certificate?

Glad you got it working! And yes, SSL is required for redirect URIs except localhost. Please see this similar question on StackOverflow: outlook-calendar-api-redirection-uri-with-vhost-not-working.

Thank you very much for the info :)