Azure Graph API:在 Quartz.NET 计划作业中处理访问令牌
Azure Graph API: Handling access token in Quartz.NET scheduled job
我正在对 Azure Graph API 进行一些研究,我计划通过 Angular 应用程序和计划作业 (Quartz.NET)
使用它
我知道在前端部分我使用 Msal Service 来处理用户身份验证以获得访问令牌。
但是..如果我要在计划的作业中向 Azure Graph API 发出请求,我是否应该在用户授权后存储用户访问令牌前端,然后在预定的作业中使用它?并在到期前续订?
我查过token lifetimes,但我还是不太清楚。
问题:如何让用户只验证一次,但以后继续从后端请求他们的信息?
access token无论是从前端还是后端获取,都不影响。
Access_tokens
是短暂的,过期后必须刷新它们才能继续访问资源。
您可以继续请求访问令牌,访问令牌将在短时间内到期(默认生命周期为一小时),您需要使用refresh token定期更新它。
但是,Msal Service that you used is based on implicit grant flow其中不提供刷新令牌。您可以在前端再次获取令牌。
Both id_tokens and access_tokens will expire after a short period of
time, so your app must be prepared to refresh these tokens
periodically. To refresh either type of token, you can perform the
same hidden iframe request from above using the prompt=none parameter
to control the identity platform's behavior.
我正在对 Azure Graph API 进行一些研究,我计划通过 Angular 应用程序和计划作业 (Quartz.NET)
使用它我知道在前端部分我使用 Msal Service 来处理用户身份验证以获得访问令牌。
但是..如果我要在计划的作业中向 Azure Graph API 发出请求,我是否应该在用户授权后存储用户访问令牌前端,然后在预定的作业中使用它?并在到期前续订?
我查过token lifetimes,但我还是不太清楚。
问题:如何让用户只验证一次,但以后继续从后端请求他们的信息?
access token无论是从前端还是后端获取,都不影响。
Access_tokens
是短暂的,过期后必须刷新它们才能继续访问资源。
您可以继续请求访问令牌,访问令牌将在短时间内到期(默认生命周期为一小时),您需要使用refresh token定期更新它。
但是,Msal Service that you used is based on implicit grant flow其中不提供刷新令牌。您可以在前端再次获取令牌。
Both id_tokens and access_tokens will expire after a short period of time, so your app must be prepared to refresh these tokens periodically. To refresh either type of token, you can perform the same hidden iframe request from above using the prompt=none parameter to control the identity platform's behavior.