gpt4 book ai didi

php - 无法使用php表单在google oauth上交换 token 的授权码

转载 作者:行者123 更新时间:2023-12-02 05:31:12 24 4
gpt4 key购买 nike

我可以很容易地获得授权代码,但在尝试用它交换访问 token 时我总是遇到错误。

    <FORM action="https://accounts.google.com/o/oauth2/auth" method="post">

<input type = "hidden" name = "code" value = "4%2FXR0s9YvmROnHOpNUuiSlfxHE7xj-">

<input type = "hidden" name = "redirect_uri" value = "http%3A%2F%2Fwww.m1448analytics.com%2Foauth2%2Frecv.php">

<input type = "hidden" name = "client_id" value = "502294831256-84q1ar05j14knsh5h2msvofu68e7rpaj.apps.googleusercontent.com">

<input type = "hidden" name = "scope" value = "">

<input type = "hidden" name = "client_secret" value = "hiding it">

<input type = "hidden" name = "grant_type" value = "authorization_code">

<INPUT type="submit" value="Send">

</FORM>

谷歌说:错误:invalid_request缺少必需的参数:response_type了解更多请求详细信息

最佳答案

您请求的网址是:

https://accounts.google.com/o/oauth2/auth

这是获取验证码的URL。现在,如果你想获得一个 token ,那么 URL 应该是:

https://accounts.google.com/o/oauth2/token

改变这个,你的代码应该可以工作。

关于php - 无法使用php表单在google oauth上交换 token 的授权码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9204085/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com