簡體   English   中英

通過授權碼授予獲得三足令牌

[英]Getting a 3-Legged Token with Authorization Code Grant

我目前正在嘗試完成此分步教程,該教程基於使用授權代碼授予獲取 3 腿令牌

這是我的卷曲代碼:

curl -v "https://developer.api.autodesk.com/authentication/v1/gettoken" 
-X POST 
-H "Content-Type:application/x-www-form-urlencoded" 
-d "client_id=****&
    client_secret=****&
    grant_type=authorization_code&
    code=1O4F-z9gXRtGlBymcGoD3bV3Ws2cqqjeN78PpgGn&
    redirect_uri=http://localhost:3000/api/forge/callback/oauth"

這是我遇到的錯誤:

{"developerMessage":"The authorization code/refresh token is expired or 
invalid/redirect_uri must have the same value as in the authorization 
request.","userMessage":"","errorCode":"AUTH-004","more 
info":"http://developer.api.autodesk.com/documentation/v1/errors/AUTH-004"}* 
Connection #0 to host developer.api.autodesk.com left intact

筆記:

  • 我已經仔細檢查了 URI 是否與我在偽造應用程序上的回調 URL 相同。
  • cURL 代碼上的間距只是出於視覺原因,這不是它在我的命令行中運行的方式。

我認為正在發生的事情是用戶登錄后獲得的代碼具有極短的到期時間。 畢竟, POST /authentication/v1/gettoken端點意味着在用戶登錄后立即調用。

順便提一句。 我經歷了相同的步驟,因為我花了一段時間用我收到的代碼創建一個 Postman 請求,所以我最終遇到了和你一樣的錯誤。 然后,當我請求另一個代碼並立即重新發送 Postman 請求時,它成功了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM