keycloakify / oidc-spa

Openid connect client for Single Page Applications
https://www.oidc-spa.dev
MIT License
48 stars 6 forks source link

Login extraParams : possiblity to add extraParams to query login #3

Closed laurentC35 closed 10 months ago

laurentC35 commented 10 months ago

Hello. I am in a case where I would like to add an additional parameter to the login url (kc_idp_hint in my case).

Would it be possible to add this possibility with an additional parameter to OidcClient like extraParams which would be a key / value object.

garronej commented 10 months ago

Hello @laurentC35,

Yes sure. You can set it at the root level but I can add extra param no problem

laurentC35 commented 10 months ago

I'm not sure I understand how to do this?

I suggest adding the argument extraQueryParams proposed by the oidc-client-ts library and add it to OidcClient signature:

Simple proposal


await userManager.signinRedirect({
    redirect_uri,
    extraQueryParams: extraQueryParams,
   "redirectMethod": doesCurrentHrefRequiresAuth ? "replace" : "assign"
});
garronej commented 10 months ago

Adding this was indeed a must.
Thank you for suggesting it!

https://github.com/garronej/oidc-spa/blob/e0a009c13fc204e01bb82dbecb1730d3ba98f4bb/README.md?plain=1#L155-L159

laurentC35 commented 10 months ago

Great, I will test this today and I'll get back to you

laurentC35 commented 10 months ago

It works perfectly. Thanks lot