Google API - OAuth 2.0 - 尝试使用 curl 获取 AccessToken
Google API - OAuth 2.0 - trying to get AccessToken using curl
尝试使用 curl 获取 AccessToken 但出现错误
“https://accounts.google.com/o/oauth2/token: 没有那个文件或目录”
有人可以帮助我做错什么吗?
主要是想知道我是否正确设置了客户端密码,虽然我不太确定,但非常感谢一些指导。
(部分内容被*删掉)
curl \
—request POST \
--data ”code=4/***********************3Uzp--0jT4uNN******rSWSRkHw8&client_id=***************************.apps.googleusercontent.com&client_secret=**********&redirect_uri=https://localhost&grant_type=authorization_code” \https://accounts.google.com/o/oauth2/token
这是我使用的代码。
# Client id from Google Developer console
# Client Secret from Google Developer console
# Scope this is a space seprated list of the scopes of access you are requesting.
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=[Scopes]&response_type=code
# Exchange Authorization code for an access token and a refresh token.
curl \
--request POST \
--data "code=[Authentcation code from authorization link]&client_id=[Application Client Id]&client_secret=[Application Client Secret]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code" \
https://accounts.google.com/o/oauth2/token
# Exchange a refresh token for a new access token.
curl \
--request POST \
--data 'client_id=[Application Client Id]&client_secret=[Application Client Secret]&refresh_token=[Refresh token granted by second step]&grant_type=refresh_token' \
https://accounts.google.com/o/oauth2/token
从我的一个要点中窃取的代码GoogleAuthenticationCurl.sh
尝试使用 curl 获取 AccessToken 但出现错误 “https://accounts.google.com/o/oauth2/token: 没有那个文件或目录” 有人可以帮助我做错什么吗?
主要是想知道我是否正确设置了客户端密码,虽然我不太确定,但非常感谢一些指导。
(部分内容被*删掉)
curl \
—request POST \
--data ”code=4/***********************3Uzp--0jT4uNN******rSWSRkHw8&client_id=***************************.apps.googleusercontent.com&client_secret=**********&redirect_uri=https://localhost&grant_type=authorization_code” \https://accounts.google.com/o/oauth2/token
这是我使用的代码。
# Client id from Google Developer console
# Client Secret from Google Developer console
# Scope this is a space seprated list of the scopes of access you are requesting.
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=[Scopes]&response_type=code
# Exchange Authorization code for an access token and a refresh token.
curl \
--request POST \
--data "code=[Authentcation code from authorization link]&client_id=[Application Client Id]&client_secret=[Application Client Secret]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code" \
https://accounts.google.com/o/oauth2/token
# Exchange a refresh token for a new access token.
curl \
--request POST \
--data 'client_id=[Application Client Id]&client_secret=[Application Client Secret]&refresh_token=[Refresh token granted by second step]&grant_type=refresh_token' \
https://accounts.google.com/o/oauth2/token
从我的一个要点中窃取的代码GoogleAuthenticationCurl.sh