Skip to main content
Version: Next

MockFetchApiOptions.injectIdentityAuth

Home > @backstage/test-utils > MockFetchApiOptions > injectIdentityAuth

Add token based Authorization headers to requests, basically simulating what FetchMiddlewares.injectIdentityAuth() does.

Signature:

injectIdentityAuth?: undefined | {
token: string;
} | {
identityApi: Pick<IdentityApi, 'getCredentials'>;
};

Remarks

Leaving out this parameter or passing undefined, disables auth injection.

To enable the feature, pass in either a static token or an identity API which is queried on each request for a token.