Office 365 应用专用令牌 Refresh/Update

Office 365 App-Only Token Refresh/Update

我目前正在检索令牌运行我想要运行的所有内容,但我不知道如何"Refresh"我的令牌。一小时后过期。这种检索 App-Only 令牌的方法不是 return 刷新令牌。

如何"Refresh/Update"令牌?

我正在使用以下方法检索令牌:

string authority = appConfig.AuthorizationUri.Replace("common", tenantId);
AuthenticationContext authenticationContext = new AuthenticationContext(authority,false);
string certfile = Server.MapPath(appConfig.ClientCertificatePfx);
X509Certificate2 cert = new X509Certificate(certfile,appConfig.ClientCertificatePfxPassword, X509KeyStorageFlags.MachineKeySet);
ClientAssertionCertificate cac = new ClientAssertionCertificate(appConfig.ClientId, cert);
var authenticationResult = await authenticationContext.AcquireTokenAsync(resource, cac);
return authenticationResult.AccessToken;

Source

再申请一个。仅应用程序令牌没有刷新。 :)