IdentityModel / oidc-client-js

OpenID Connect (OIDC) and OAuth2 protocol support for browser-based JavaScript applications
Apache License 2.0
2.43k stars 841 forks source link

How to override state parameter in the oidc-client library #1277

Closed ienaveen closed 3 years ago

ienaveen commented 3 years ago

How to explicitly specify the "state" parameter while sending the oauth request to the IDP I can see that the oidc-client library is adding one automatically, but can we override it? When pass the state in the extraQueryParams .It is appending the variable rather than overriding it extraQueryParams: { state:'12345'}

Do we have a way to override and pass a custom state value like idp_url?client_id=xxx&state=123456& redirect_uri=xxx"

brockallen commented 3 years ago

state is a reserved protocol param. The UserManager controls it. If you simply want to send custom params to the STS, use the extraQueryParams.

ienaveen commented 3 years ago

@brockallen Is there a way to override state programatically as we need to send a custom value in the state parameter for our External Idp?

brockallen commented 3 years ago

I don't understand why the state param. Why not the official acr_values or some other custom param? The state param is for the client to round trip state to itself. It's not meant to be used by the STS.