dermesser / yup-oauth2

An oauth2 client implementation providing the Device, Installed, Service Account, and several more flows.
https://docs.rs/yup-oauth2/
Apache License 2.0
213 stars 114 forks source link

Support for login_hint parameter #201

Open OMGeeky opened 1 year ago

OMGeeky commented 1 year ago

I find myself in a position where I need to login the user on the same browser with a different channel, sometimes shortly after authenticating with one. If i let the user click the link to authenticate then it just immediately takes him to the redirect uri without the chance of selecting a different account/channel(youtube). I think this problem should be solvable by using the 'login_hint' parameter that does not seem to be available in this library.

This is the documentation for the parameter login_hint which says:

When your app knows which user it is trying to authenticate, it can provide this parameter as a hint to the authentication server. Passing this hint suppresses the account chooser and either pre-fills the email box on the sign-in form, or selects the proper session (if the user is using multiple sign-in), which can help you avoid problems that occur if your app logs in the wrong user account. The value can be either an email address or the sub string, which is equivalent to the user's Google ID.


I might try to poke around the code and implement this myself when I get the time for it, but I'm not too good at Rust yet so any help or guidance would be appreciated.