php-connect-rest-sample icon indicating copy to clipboard operation
php-connect-rest-sample copied to clipboard

Refresh token is missing from access token generation.

Open alextselegidis opened this issue 9 years ago • 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

alextselegidis avatar Dec 06 '16 21:12 alextselegidis

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

DianeD avatar Dec 06 '16 21:12 DianeD

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?

alextselegidis avatar Dec 06 '16 21:12 alextselegidis

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.

DianeD avatar Dec 06 '16 22:12 DianeD

Thank you very much for the info :)

alextselegidis avatar Dec 06 '16 22:12 alextselegidis