-
Notifications
You must be signed in to change notification settings - Fork 926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing custom query parameters in authorize endpoint #341
Comments
I would reread the documentation for schemes. You can write your own scheme. This is useful if you are using a more complex auth0 configuration than what the default provider can provide. For instance, if you need to use the cross-origin authentication then you can also write your own scheme for that purpose. |
@web3devin thanks a lot this helped. In a bit more detail, the module config in nuxtconfig.js looks like: strategies: {
auth0custom: {
_scheme: '~/pathTo/customAuthStrategy.js',
authorization_endpoint: `https://${domain}.auth0.com/authorize`,
userinfo_endpoint: `https://${domain}.auth0.com/userinfo`,
scope: ['openid', 'profile', 'email'],
domain: `${domain}.auth0.com`,
client_id: 'the_client_id',
language: 'en',
audience: 'your_audience_here',
customProp: 'custom_value',
},
} The login() {
const opts = {
protocol: 'oauth2',
response_type: this.options.response_type,
client_id: this.options.client_id,
redirect_uri: this._redirectURI,
scope: this._scope,
state: randomString(),
language: this.options.language,
audience: this.options.audience,
customProp: this.options.customProp,
}; Then before calling the this.$auth.strategies.auth0custom.options.language = 'el';
await this.$auth.loginWith('auth0custom'); Thanks. |
In 2020 you can try |
What problem does this feature solve?
The option to pass custom query params in the authorize endpoint (in this scenario for Auth0) can help in the following scenarios:
language
param, and then extracting it at the Auth0 side)What does the proposed changes look like?
Looking at
/lib/schemes/oauth2.js
, methodlogin()
, we see that the options are hardcoded before passed for encoding.Inside this
opts
object we can destructure the custom properties that we’ll want to pass to theauthorize
endpoint, like so:Then, in the app's code we can add an arbitrary set of query parameters like so:
The text was updated successfully, but these errors were encountered: