GoogleAPI-OAuth2.0-尝试使用curl获取AccessToken

GoogleAPI-OAuth2.0-尝试使用curl获取AccessToken,curl,google-api,google-oauth,omniauth-google-oauth2,Curl,Google Api,Google Oauth,Omniauth Google Oauth2,尝试使用curl获取AccessToken,但获取错误为 "https://accounts.google.com/o/oauth2/token: 没有这样的文件或目录“ 有人能帮我做错事吗 主要是,我想知道我是否正确地设置了客户机密,虽然我很不确定,但我真的希望得到一些指导 (已由*编辑了部分内容) 这是我使用的代码 # Client id from Google Developer console # Client Secret from Google Developer console #

尝试使用curl获取AccessToken,但获取错误为 "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

从我的注册表中撕下的代码

这是我使用的代码

# 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

从我的一个注册表中撕下的代码

谢谢,我得到了访问令牌。你的ans是正确的,正是我要找的,再次感谢。谢谢,我得到了访问令牌。你的ans是正确的,正是我要找的,再次感谢。