解決使用Microsoft Graph OAuth獲取令牌時,沒有refresh_token的問題


今天在使用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的使用。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM