I have Kiota SDK beta MS Grapch for PHP with auth by code. I don't know how add refresh token because now after every reload page application require new auth code. Is posible add refresh token?
$tokenRequestContext = new AuthorizationCodeContext(
'tenantId',
'clientId',
'clientSecret',
'authCode',
'redirectUri'
);
$scopes = ['User.Read', 'Mail.ReadWrite'];
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$user = $graphServiceClient->users()->byUserId('[userPrincipalName]')->get()->wait();
I created an Azure AD Application and granted API permissions like below:
Now, I generated auth-code using below endpoint:
Access token and refresh token got generated successfully by using below parameters via Postman.
You can refresh the access token by using refresh token like below:
Modify the code by adding the API permission like below: