-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reverted token changes to fix audience issue (#14)
- Loading branch information
Showing
9 changed files
with
57 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,5 +32,6 @@ node_modules | |
.DS_Store | ||
.idea | ||
dist | ||
server/config.json | ||
|
||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "auth0-authentication-api-debugger-extension", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "My extension for ..", | ||
"main": "index.js", | ||
"scripts": { | ||
|
@@ -19,6 +19,7 @@ | |
"externals": [ | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"cors", | ||
"[email protected]", | ||
"handlebars", | ||
|
@@ -35,6 +36,7 @@ | |
"dependencies": { | ||
"auth0-extension-express-tools": "^1.1.9", | ||
"auth0-extension-tools": "^1.3.3", | ||
"auth0-oauth2-express": "1.2.0", | ||
"body-parser": "^1.15.2", | ||
"cors": "2.8.1", | ||
"crypto": "^0.0.3", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const url = require('url'); | ||
const auth0 = require('auth0-oauth2-express'); | ||
|
||
module.exports = function(domain, title, rta) { | ||
if (!domain) throw new Error('Domain is required'); | ||
if (!title) throw new Error('title is required'); | ||
|
||
const options = { | ||
credentialsRequired: false, | ||
scopes: 'read:clients read:client_keys', | ||
clientName: title, | ||
audience: function() { | ||
return 'https://' + domain + '/api/v2/'; | ||
}, | ||
rootTenantAuthority: rta | ||
}; | ||
|
||
const middleware = auth0(options); | ||
return function(req, res, next) { | ||
const protocol = 'https'; | ||
const pathname = (req.x_wt) | ||
? url.parse(req.originalUrl).pathname | ||
.replace(req.x_wt.container, 'req.x_wt.container') | ||
.replace(req.path, '') | ||
.replace('req.x_wt.container', req.x_wt.container) | ||
: url.parse(req.originalUrl).pathname | ||
.replace(req.path, ''); | ||
|
||
const baseUrl = url.format({ | ||
protocol: protocol, | ||
host: req.get('host'), | ||
pathname: pathname | ||
}); | ||
|
||
options.clientId = baseUrl; | ||
return middleware(req, res, next); | ||
}; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters