今天在使用Microsoft Graph 的时候,发现按照官方文档,无论如何都不能获取refresh_token,其他都没问题,经过查询,发现是因为在第一步,获取code授权时,没有给离线权限(offline_access)。

加上就可以了。

代码片段:

    {
      client_id: 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx',
      response_type: 'code',
      redirect_uri: 'http://localhost:3000/callback',
      response_mode: 'query', 
      scope: 'user.read offline_access',
    };

 

注意标红位置。

参考资料:https://stackoverflow.com/questions/42533257/receiving-access-token-but-not-the-refresh-token-from-microsoft-graph-api

 

有空详细总结一下 Microsoft Graph api的使用。

 

相关文章:

  • 2022-12-23
  • 2021-10-29
  • 2022-01-09
  • 2022-12-23
  • 2021-12-26
  • 2022-02-20
  • 2021-09-27
  • 2022-01-02
猜你喜欢
  • 2022-12-23
  • 2021-11-18
  • 2022-02-01
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
相关资源
相似解决方案