Add additional Query Parameters to OAuth2 Login Flow
ytsdv opened this issue · comments
Currently there seems to be no way to add custom query parameters to the OAuth url of a provider.
I stumbled on this issue while using discord as oauth provider and trying to skip the authentication step if the user already authenticated once.
Discord lets you skip the authentication screen if you provide the query parameter prompt=none
discord docs.
As i am seeing it this option could be added to the config object you pass to authWithOAuth2
You can specify your own urlCallback
and do anything with its url argument.
await pb.collection("users").authWithOAuth2({
provider: "discord",
urlCallback: (url) => {
// modify the url, for example by converting it to URL: https://developer.mozilla.org/en-US/docs/Web/API/URL
// ...
window.open(url, "popup_window", "width=500,height=500,resizable,menubar=no");
},
})
Other OAuth2 config options could be added eventually as part of #265 but for now remains a low priority.