Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Usage of response_type="code token" in OAuth 2?

The OpenID Connect Spec OAuth 2.0 Multiple Response Type Encoding Practices states that multiple response_type can be combined, e.g. response_type="code token". Now I'm wondering what it's good for to request an authorization code and the token. Isn't the auth code superfluous if you have the token already?

like image 874
James Avatar asked Oct 18 '25 04:10

James


2 Answers

OAuth 2.0 is a protocol framework on top of which other protocols can be built and OpenID Connect is an example of such a protocol.

Especially for OpenID Connect it makes sense to use combined response types because there are 2 tokens in play: the access_token and the id_token. Using "response_type" the client can request how each of the tokens should be delivered.

In the example that that you give, the access_token will be delivered through the front channel as part of the authentication response but the id_token will be delivered when exchanging the "code" for an id_token at the token endpoint in a backchannel call.

A reason for doing this may be that the id_token, which is a signed JWT, does not have to be verified locally when obtained from a proper TLS protected token endpoint, so the client code can be simple. The access_token is opaque to the client anyhow and does not benefit from that.

like image 117
Hans Z. Avatar answered Oct 20 '25 19:10

Hans Z.


I've never seen this used in practice. Yes, having the token already kind of diminishes the value of using the code flow.

like image 27
Eugenio Pace Avatar answered Oct 20 '25 19:10

Eugenio Pace



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!