mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-23 13:46:45 +02:00
feat: custom unleash auth header
This commit is contained in:
parent
38d02e1a85
commit
3d25d1aaff
@ -48,7 +48,12 @@ const apiAccessMiddleware = (
|
||||
}
|
||||
|
||||
try {
|
||||
const apiToken = req.header('authorization');
|
||||
const apiToken = req.header('x-unleash-auth')
|
||||
? req.header('x-unleash-auth')
|
||||
: req.header('authorization');
|
||||
|
||||
console.log('TOKEN', apiToken, req.headers);
|
||||
|
||||
if (!apiToken?.startsWith('user:')) {
|
||||
const apiUser = apiToken
|
||||
? apiTokenService.getUserForToken(apiToken)
|
||||
|
@ -20,7 +20,7 @@ const authorizationMiddleware = (
|
||||
if (req.user) {
|
||||
return next();
|
||||
}
|
||||
if (req.header('authorization')) {
|
||||
if (req.header('x-unleash-auth') || req.header('authorization')) {
|
||||
// API clients should get 401 with a basic body
|
||||
const error = new UnauthorizedError(
|
||||
'You must log in to use Unleash.',
|
||||
|
Loading…
Reference in New Issue
Block a user