1
此問題與Google OAuth2中的授權碼和include_granted_scopes
有關,用於逐步更改範圍。請求更多示波器迴應最新授權碼
在我的web應用程序,我要求的基本個人資料信息的範圍:
當Gmail用戶的跡象了我們。在用戶執行一些操作後,我通過在授權URL中設置"include_granted_scopes=true"
來請求額外的範圍。
在這一點上,我的授權URL看起來像這樣:
https://accounts.google.com/o/oauth2/auth?client_id=3490600xyz00-xyz....apps.googleusercontent.com&[email protected]&redirect_uri=https://www.example.com/google-signup-callback&response_type=code&scope=https://mail.google.com https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/gmail.compose https://www.googleapis.com/auth/gmail.modify&access_type=offline&approval_prompt=force&state=da503933-8979-409b-988a-24a9542ad98a&redirect=label&include_granted_scopes=true
現在在OAuth回調,我得到當我做了OAuth的早期使用的基本輪廓範圍,我收到了同樣的「Authorization code
」。如果我試圖通過調用「https://accounts.google.com/o/oauth2/token」以獲取授權令牌「grant_type
」設置爲「authorization_code
」,則返回
「代碼已經被視爲」。
現在我該如何獲得具有新範圍的新「驗證令牌」和「刷新令牌」?即使使用舊的刷新令牌刷新它,舊的認證令牌也沒有新的作用域。
嘗試添加提示=同意 – DaImTo
真棒,工作。我必須用「提示=同意」替換「approval_prompt = force」。如果你能把它作爲答案,我會接受的。 – user3787910