Receiving access token but not the refresh token from Microsoft Graph API
As DalmTo said, you need to request offline access to get a refresh token. You do this by adding offline_access
to your scope
.
In your case:
echo "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?" . "client_id=$client_id" . "&" . "scope=" . "offline_access" . "%20" . "https%3A%2F%2Fgraph.microsoft.com%2FUser.Read" . "%20" . "https%3A%2F%2Fgraph.microsoft.com%2FCalendars.Read" . "%20" . "https%3A%2F%2Fgraph.microsoft.com%2FCalendars.Read.Shared" . "&response_type=code" . "&redirect_uri=" . urlencode($redirect);