Skip to main content

getBearerTokenFromAuthorizationHeader()

Home > @backstage/plugin-auth-node > getBearerTokenFromAuthorizationHeader

Warning: This API is now obsolete.

Use the credentials method of HttpAuthService from @backstage/backend-plugin-api instead

Parses the given authorization header and returns the bearer token, or undefined if no bearer token is given.

Signature:

function getBearerTokenFromAuthorizationHeader(authorizationHeader: unknown): string | undefined;

Parameters

Parameter

Type

Description

authorizationHeader

unknown

**Returns:**

string | undefined

Remarks

This function is explicitly built to tolerate bad inputs safely, so you may call it directly with e.g. the output of req.header('authorization') without first checking that it exists.