Allow client to pass arbitrary additional data into challenge parameters when initiating auth

Hello,

I’ve read this topic and I have a similar use case that should enable multiple social login providers to my app, e.g. Google and GitHub. Specifically, I’d like my login page with social login buttons of Google, GitHub, etc.
The topic’s author @Obrys finally ended up letting the user choose his/her provider at the login app. However as far as I understand, it would have to involve server side rendering, since the login app’s logic lies at server side while having to provide the UI for choosing the provider; and IMHO it is difficult to integrate into single page apps or mobile apps with such design. I’d like my login app serve merely as a proxy for login pages of Google and GitHub, not defining a UI of its own, i.e. with minimal server side rendering, if at all. That’s why I’m searching for an alternative way of achieving this.
The most obvious approach I’ve come up with would be adding additional data into challenge parameters. For example, when the user hits the ‘Login with Google’ button on client, the client, while initiating auth, may state that the user is logging in with his/her Google account, so that the login app may fetch this information along with the challenge parameters, thus taking the user to the Google login page.

Is there any way to achieve this currently with Hydra, or is there any plan to add this feature, or is there better way of achieving this?

Thanks.

While this obviously only works for first party clients you can simply append a query parameter to the /oauth2/auth URL e.g. /oauth2/auth?client_id=...&...&upstream=google. The URL is available when you look up the login and/or consent challenge as part of the response coming from Hydra’s Login/Consent API.

1 Like