Skip to content

ManagedLoginBranding

Source: src/AWS/Cognito/ManagedLoginBranding.ts

A managed login branding style for an Amazon Cognito user pool app client. Assigning a style (even just Cognito’s provided defaults) is what activates the hosted managed login pages — a UserPoolDomain with managedLoginVersion: 2 serves them end-to-end without any console step.

import * as Cognito from "alchemy/AWS/Cognito";
const pool = yield* Cognito.UserPool("Users", {});
const client = yield* Cognito.UserPoolClient("Web", {
userPoolId: pool.userPoolId,
callbackUrls: ["https://example.com/callback"],
allowedOAuthFlowsUserPoolClient: true,
allowedOAuthFlows: ["code"],
allowedOAuthScopes: ["openid", "email"],
});
const domain = yield* Cognito.UserPoolDomain("AuthDomain", {
userPoolId: pool.userPoolId,
managedLoginVersion: 2,
});
yield* Cognito.ManagedLoginBranding("Branding", {
userPoolId: pool.userPoolId,
clientId: client.clientId,
});
yield* Cognito.ManagedLoginBranding("Branding", {
userPoolId: pool.userPoolId,
clientId: client.clientId,
settings: brandingSettings, // designer-exported JSON document
assets: [{
category: "FORM_LOGO",
colorMode: "LIGHT",
extension: "PNG",
bytes: logoBytes,
}],
});