簡體   English   中英

Firebase REST API 刷新令牌上的 INVALID_ARGUMENT

[英]Firebase REST API INVALID_ARGUMENT on refresh-token

昨天我們開始遇到 REST API 問題,特別是刷新令牌方法: https://firebase.google.com/docs/reference/rest/auth/#section-refresh-token

curl 'https://securetoken.googleapis.com/v1/token?key=[API_KEY]' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data 'grant_type=refresh_token&refresh_token=[REFRESH_TOKEN]'

我們使用文檔中的 curl 示例和我們自己的開發(使用 PHP 和 Guzzle)嘗試了此調用,我們總是會收到此錯誤:

"error": {
        "code": 400,
        "message": "Request contains an invalid argument.",
        "status": "INVALID_ARGUMENT"
    }

當你從谷歌的數據中心內部撥打電話時,看起來會發生這種情況,它對我們本地工作正常。 它在14日開始發生在我們身上。 我向firebase團隊提出了一個錯誤。

firebase團隊回復了我。 似乎這個問題已經解決了。 你可以檢查一下嗎?

Thanks for patiently waiting, and apologies for the inconvenience this might have caused you.

Our engineers have made some changes on our end. Could you please retry and see if the issue persists? 

If yes, please let me know and provide the necessary information that could help us investigate more on the issue.

祝你有美好的一天 !

我使用Python(使用與問題中使用的相同的API)具有完全相同的問題。 我已經通過Firebase支持提出了它,他們今天告訴我它已修復。 我已經對它進行了測試,它對我來說很好,無論是在本地(它沒有被破壞),還是來自Google App Engine。

所以,似乎問題是暫時的,你現在應該再試一次。

您應該將-H 'Content-Type: application/x-www-form-urlencoded'更改為-H 'Content-Type: application/json' 那么API就會運行成功。

並記住請求正文(有效負載)如下(JSON):

{
    "grant_type": "refresh_token",
    "refresh_token": "...current refresh token..."
}

暫無
暫無

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

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