OAuth refresh token from Azure Bot Service

Tom023 46 Reputation points
2020-08-02T08:51:42.107+00:00

I am using the OAuth capability in Azure Bot service to access the Microsoft Graph.

I need to communicate with the SharePoint Online REST endpoint. Typically, I would request and cache a refresh token from AAD, then use that refresh token to acquire a second access token, specifying the sharepoint.com address as the resource.

When using the OAuth connections in the Azure Bot service, I can get an access token by calling the GetUserToken method of the dialog context. However, I cannot get the refresh token from the bot service.

So, Is the refresh token exposed as part of the BotBuilder library, or in any other style?

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
756 questions
0 comments No comments
{count} votes

Accepted answer
  1. Destin Joy 1,866 Reputation points
    2020-08-02T08:59:54.933+00:00

    You must include the offline_access scope on your OAuth Bot configuration and on bots API permission within your Azure bot registration (Go to AAD - Application Registration (Preview) - API Permission).

    Otherwise the bot service will not be able to refresh the token when it expired after 60 minutes by default. https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-configurable-token-lifetimes#token-types

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful