(invalid_grant) 缺少代码验证器 google-ads-api
(invalid_grant) Missing code verifier google-ads-api
按照OAuth Web Application Flow的建议。
回调 url 就像
https://xxxxxxx:9431/callback_gg/?state=OV8xxxxxx0Nda6B4xxdR6VtAcyBEH&code=4/pAFG4kRxxxx9qLR7Oaxe1-2LYClj7d1EvP7peblfpm5TMEragm1X0Knrs9yLRekxxxxxUC2EcXne_14A4&scope=https://www.googleapis.com/auth/adwords
我正在尝试
#If the client opted to allow you to access their account, you will
#receive an authorization code in the response as a query string.
#This #can be used to retrieve an access and refresh token with the
#following #lines of code
flow.fetch_token(code=auth_code)
credentials = flow.credentials
但是我发现错误
oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) Missing code verifier.
我错过了什么吗?我对这个错误感到困惑,因为我正在关注 api 文档
报错提示需要在授权请求中添加code_challenge
请求参数和code_challenge_method=S256
请求参数,在token请求中添加code_verifier
请求参数.
有关 RFC 7636 的技术细节,参数在 RFC 7636 (Proof Key for Code Exchange by OAuth Public Clients). See this article 中定义。
Google 的文档不是最新的,或者即使您在令牌请求中包含 code_verifier
也看到相同的错误,但错误消息本身是错误的且具有误导性。
按照OAuth Web Application Flow的建议。
回调 url 就像
https://xxxxxxx:9431/callback_gg/?state=OV8xxxxxx0Nda6B4xxdR6VtAcyBEH&code=4/pAFG4kRxxxx9qLR7Oaxe1-2LYClj7d1EvP7peblfpm5TMEragm1X0Knrs9yLRekxxxxxUC2EcXne_14A4&scope=https://www.googleapis.com/auth/adwords
我正在尝试
#If the client opted to allow you to access their account, you will
#receive an authorization code in the response as a query string.
#This #can be used to retrieve an access and refresh token with the
#following #lines of code
flow.fetch_token(code=auth_code)
credentials = flow.credentials
但是我发现错误
oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) Missing code verifier.
我错过了什么吗?我对这个错误感到困惑,因为我正在关注 api 文档
报错提示需要在授权请求中添加code_challenge
请求参数和code_challenge_method=S256
请求参数,在token请求中添加code_verifier
请求参数.
有关 RFC 7636 的技术细节,参数在 RFC 7636 (Proof Key for Code Exchange by OAuth Public Clients). See this article 中定义。
Google 的文档不是最新的,或者即使您在令牌请求中包含 code_verifier
也看到相同的错误,但错误消息本身是错误的且具有误导性。