如何使用Postman配合AAD帳密及App獲取access_token和refresh_token

Post的網址POST https://login.microsoftonline.com/{{AAD_name}}/oauth2/token

grant_type : 本例為password

client_id : 應用程式ID

client_secret : 應用程式密碼

resource :https://graph.microsoft.com

username :完整使用者名稱

password : 上面使用者的密碼

scope:openid

應用程式ID和密碼建立可以參考其他文章

填好相應的內容後點擊Send後返回的結果

其中expires_on是到期時間,是Unix時間戳,可以在這裡查詢對應的具體時間。

access_token 效期一個小時

refresh_token 效期90天,在有效期內可以使用refresh_token來獲取access_token

權杖的時間說明:https://docs.microsoft.com/zh-tw/azure/active-directory/develop/active-directory-configurable-token-lifetimes