UBERF-9526 Fix order of token locations in services (#8101)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2025-02-26 16:49:17 +03:00 committed by GitHub
parent 669ea11d03
commit d442787574
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -35,7 +35,7 @@ const extractAuthorizationToken = (authorization?: string): Token | null => {
export function extractToken (headers: IncomingHttpHeaders): Token | undefined {
try {
const token = extractCookieToken(headers.cookie) ?? extractAuthorizationToken(headers.authorization)
const token = extractAuthorizationToken(headers.authorization) ?? extractCookieToken(headers.cookie)
return token ?? undefined
} catch {

View File

@ -80,9 +80,9 @@ const extractQueryToken = (queryParams: any): string | null => {
const extractToken = (headers: IncomingHttpHeaders, queryParams: any): string => {
try {
const token =
extractCookieToken(headers.cookie) ??
extractAuthorizationToken(headers.authorization) ??
extractQueryToken(queryParams)
extractQueryToken(queryParams) ??
extractCookieToken(headers.cookie)
if (token === null) {
throw new ApiError(401)

View File

@ -51,9 +51,9 @@ const extractRawQueryToken = (queryParams: any): string | null => {
export const extractToken = (headers: IncomingHttpHeaders, queryParams: any): { token: Token, rawToken: string } => {
try {
const rawToken =
extractRawCookieToken(headers.cookie) ??
extractRawAuthorizationToken(headers.authorization) ??
extractRawQueryToken(queryParams)
extractRawQueryToken(queryParams) ??
extractRawCookieToken(headers.cookie)
if (rawToken === null) {
throw new ApiError(401)