Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
721 views
in Technique[技术] by (71.8m points)

oauth - can I use grant_type=client_credentials for google api?

I create a clientid, and clientcredentials in google console. when I request the token with grant_type=client_credentials. I got 401 unauthrorized.

{
  "error": "invalid_client",
  "error_description": "Unauthorized",
  "error_uri": ""
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The error means that you are not authenticated. Also client_credentials is not a valid value for grant_type that I am aware of.

The only ones I know of are

  • authorization_code
  • refresh_token

It looks like grant_type=client_credentials is part of the RFC for Oauth2 but its not something I have seen implemented in Googles Authentication servers.

Anwser: No to my knowledge you cant use grant_type=client_credentials with Google APis.

update: just got word back from Google. I was correct they do not support this grant_type.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...