Skip to main content

Migrating authentication to v45

Overview​

Version 45 passes a context object to customization.setCustomHeaders. The object holds the auth scope and the resolved client IP of the request.

Blueprint Auth now controls the authentication and client IP headers of each request to Kraken. OAuth requests to the Kraken Auth Server now include the custom headers and the client IP headers.

Complete the following steps before you deploy the new version.

Migration steps​

Step 1: Update the package​

pnpm update @krakentech/blueprint-auth@^45

Step 2: Update setCustomHeaders callbacks​

customization.setCustomHeaders now receives (headers, context). Read authScope from the second argument:

Before:

export const authConfig = createAuthConfig({
customization: {
setCustomHeaders(headers, authScope) {
if (authScope === "organization") {
headers.set("x-custom-org-header", "value");
}
},
},
});

After:

export const authConfig = createAuthConfig({
customization: {
setCustomHeaders(headers, { authScope }) {
if (authScope === "organization") {
headers.set("x-custom-org-header", "value");
}
},
},
});

Callbacks that use only headers do not need a change. If you declare the type of the second parameter, use SetCustomHeadersContext.