Skip to content
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

Add audience to Auth0 request. Fixes #176. #222

Merged
merged 1 commit into from
Aug 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/providers/_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ function assignDefaults (strategy, defaults) {
}

function addAuthorize (strategy) {
// Get client_secret, client_id and token_endpoint
// Get client_secret, client_id, token_endpoint and audience
const clientSecret = strategy.client_secret
const clientID = strategy.client_id
const tokenEndpoint = strategy.token_endpoint
const audience = strategy.audience

// IMPORTANT: remove client_secret from generated bundle
delete strategy.client_secret
Expand Down Expand Up @@ -54,6 +55,7 @@ function addAuthorize (strategy) {
grant_type: grantType,
response_type: responseType,
redirect_uri: redirectUri,
audience: audience,
code
},
headers: {
Expand Down
3 changes: 2 additions & 1 deletion lib/providers/auth0.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = function auth0 (strategy) {
_scheme: 'oauth2',
authorization_endpoint: `https://${strategy.domain}/authorize`,
userinfo_endpoint: `https://${strategy.domain}/userinfo`,
scope: ['openid', 'profile', 'email']
scope: ['openid', 'profile', 'email'],
audience: strategy.domain
})
}
2 changes: 2 additions & 0 deletions lib/schemes/oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export default class Oauth2Scheme {
client_id: this.options.client_id,
redirect_uri: this._redirectURI,
scope: this._scope,
audience: this.options.audience,
state: randomString()
}

Expand Down Expand Up @@ -125,6 +126,7 @@ export default class Oauth2Scheme {
client_id: this.options.client_id,
redirect_uri: this._redirectURI,
response_type: this.options.response_type,
audience: this.options.audience,
grant_type: this.options.grant_type
})
})
Expand Down