Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google's OpenID Connect says: OAuth 2 parameters can only have a single value: client_id

As part of the OpenID Connect (OAuth2 for Login), my application is supposed to request an access token, given a one-time authorization code, via the endpoint https://www.googleapis.com/oauth2/v3/token. According to documentation, this request needs 5 parameters passed to it, client_id among them. That is exactly what my application does, using the Perl module Net::OAuth2.

Everything has been working fine for several months, but today I was notified that it stopped working. No updates were made to the application code nor the libraries used by it.

The message my application now receives from the server when calling the token endpoint is this, in a 400 error response:

OAuth 2 parameters can only have a single value: client_id

A Google search suggests nobody has ever seen this message before, or lived to tell the tale. There doesn't seem to be a general issue with Google's OpenID Connect (other services based on it are working flawlessly), and the imminent shutdown of the old login protocol doesn't seem relevant.

More testing: removing all parameters except client_id causes this error message:

Required parameter is missing: grant_type

Supplying only client_id and grant_type produces the original error message again.

Does anyone have an idea what's going on here?

like image 635
Jan Krüger Avatar asked Apr 17 '15 09:04

Jan Krüger


People also ask

What is OAuth 2.0 OpenID Connect?

OpenID Connect is an authentication standard built on top of OAuth 2.0. It adds an additional token called an ID token. OpenID Connect also standardizes areas that OAuth 2.0 leaves up to choice, such as scopes, endpoint discovery, and dynamic registration of clients.

How does Google OAuth 2.0 work?

OAuth 2.0 allows users to share specific data with an application while keeping their usernames, passwords, and other information private. For example, an application can use OAuth 2.0 to obtain permission from users to store files in their Google Drives. This OAuth 2.0 flow is called the implicit grant flow.

What is the difference between OpenID Connect and oauth2?

OAuth 2.0 is designed only for authorization, for granting access to data and features from one application to another. OpenID Connect (OIDC) is a thin layer that sits on top of OAuth 2.0 that adds login and profile information about the person who is logged in.


1 Answers

Google changed this behavior few days ago, so any OAuth2 library using Basic Auth headers AND body request parameters will start to see messages like

OAuth 2 parameters can only have a single value: client_id

or

OAuth 2 parameters can only have a single value: client_secret

So, you must now do NOT use both (the Auth headers and body request parameters) at the same time to send credentials to Google.

And according RFC 6749, the preferable way to send credentials is through Auth headers (thanks @JanKrüger for alert me about this).

like image 199
Rael Gugelmin Cunha Avatar answered Sep 27 '22 19:09

Rael Gugelmin Cunha