CognitoIdentityProvider / Client / create_managed_login_branding

create_managed_login_branding#

CognitoIdentityProvider.Client.create_managed_login_branding(**kwargs)#

Creates a new set of branding settings for a user pool style and associates it with an app client. This operation is the programmatic option for the creation of a new style in the branding designer.

Provides values for UI customization in a Settings JSON object and image files in an Assets array. To send the JSON object Document type parameter in Settings, you might need to update to the most recent version of your Amazon Web Services SDK.

This operation has a 2-megabyte request-size limit and include the CSS settings and image assets for your app client. Your branding settings might exceed 2MB in size. Amazon Cognito doesn’t require that you pass all parameters in one request and preserves existing style settings that you don’t specify. If your request is larger than 2MB, separate it into multiple requests, each with a size smaller than the limit.

For more information, see API and SDK operations for managed login branding

Note

Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

See also: AWS API Documentation

Request Syntax

response = client.create_managed_login_branding(
    UserPoolId='string',
    ClientId='string',
    UseCognitoProvidedValues=True|False,
    Settings={...}|[...]|123|123.4|'string'|True|None,
    Assets=[
        {
            'Category': 'FAVICON_ICO'|'FAVICON_SVG'|'EMAIL_GRAPHIC'|'SMS_GRAPHIC'|'AUTH_APP_GRAPHIC'|'PASSWORD_GRAPHIC'|'PASSKEY_GRAPHIC'|'PAGE_HEADER_LOGO'|'PAGE_HEADER_BACKGROUND'|'PAGE_FOOTER_LOGO'|'PAGE_FOOTER_BACKGROUND'|'PAGE_BACKGROUND'|'FORM_BACKGROUND'|'FORM_LOGO'|'IDP_BUTTON_ICON',
            'ColorMode': 'LIGHT'|'DARK'|'DYNAMIC',
            'Extension': 'ICO'|'JPEG'|'PNG'|'SVG'|'WEBP',
            'Bytes': b'bytes',
            'ResourceId': 'string'
        },
    ]
)
Parameters:
  • UserPoolId (string) –

    [REQUIRED]

    The ID of the user pool where you want to create a new branding style.

  • ClientId (string) –

    [REQUIRED]

    The app client that you want to create the branding style for. Each style is permanently linked to an app client. To change the style for an app client, delete the existing style with DeleteManagedLoginBranding and create a new one.

  • UseCognitoProvidedValues (boolean) –

    When true, applies the default branding style options. This option reverts to default style options that are managed by Amazon Cognito. You can modify them later in the branding designer.

    When you specify true for this option, you must also omit values for Settings and Assets in the request.

  • Settings (document) – A JSON file, encoded as a Document type, with the the settings that you want to apply to your style.

  • Assets (list) –

    An array of image files that you want to apply to roles like backgrounds, logos, and icons. Each object must also indicate whether it is for dark mode, light mode, or browser-adaptive mode.

    • (dict) –

      An image file from a managed login branding style in a user pool.

      This data type is a request parameter of CreateManagedLoginBranding and UpdateManagedLoginBranding, and a response parameter of DescribeManagedLoginBranding.

      • Category (string) – [REQUIRED]

        The category that the image corresponds to in your managed login configuration. Managed login has asset categories for different types of logos, backgrounds, and icons.

      • ColorMode (string) – [REQUIRED]

        The display-mode target of the asset: light, dark, or browser-adaptive. For example, Amazon Cognito displays a dark-mode image only when the browser or application is in dark mode, but displays a browser-adaptive file in all contexts.

      • Extension (string) – [REQUIRED]

        The file type of the image file.

      • Bytes (bytes) –

        The image file, in Base64-encoded binary.

      • ResourceId (string) –

        The ID of the asset.

Return type:

dict

Returns:

Response Syntax

{
    'ManagedLoginBranding': {
        'ManagedLoginBrandingId': 'string',
        'UserPoolId': 'string',
        'UseCognitoProvidedValues': True|False,
        'Settings': {...}|[...]|123|123.4|'string'|True|None,
        'Assets': [
            {
                'Category': 'FAVICON_ICO'|'FAVICON_SVG'|'EMAIL_GRAPHIC'|'SMS_GRAPHIC'|'AUTH_APP_GRAPHIC'|'PASSWORD_GRAPHIC'|'PASSKEY_GRAPHIC'|'PAGE_HEADER_LOGO'|'PAGE_HEADER_BACKGROUND'|'PAGE_FOOTER_LOGO'|'PAGE_FOOTER_BACKGROUND'|'PAGE_BACKGROUND'|'FORM_BACKGROUND'|'FORM_LOGO'|'IDP_BUTTON_ICON',
                'ColorMode': 'LIGHT'|'DARK'|'DYNAMIC',
                'Extension': 'ICO'|'JPEG'|'PNG'|'SVG'|'WEBP',
                'Bytes': b'bytes',
                'ResourceId': 'string'
            },
        ],
        'CreationDate': datetime(2015, 1, 1),
        'LastModifiedDate': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) –

    • ManagedLoginBranding (dict) –

      The details of the branding style that you created.

      • ManagedLoginBrandingId (string) –

        The ID of the managed login branding style.

      • UserPoolId (string) –

        The user pool where the branding style is assigned.

      • UseCognitoProvidedValues (boolean) –

        When true, applies the default branding style options. This option reverts to a “blank” style that you can modify later in the branding designer.

      • Settings (document) –

        A JSON file, encoded as a Document type, with the the settings that you want to apply to your style.

      • Assets (list) –

        An array of image files that you want to apply to roles like backgrounds, logos, and icons. Each object must also indicate whether it is for dark mode, light mode, or browser-adaptive mode.

        • (dict) –

          An image file from a managed login branding style in a user pool.

          This data type is a request parameter of CreateManagedLoginBranding and UpdateManagedLoginBranding, and a response parameter of DescribeManagedLoginBranding.

          • Category (string) –

            The category that the image corresponds to in your managed login configuration. Managed login has asset categories for different types of logos, backgrounds, and icons.

          • ColorMode (string) –

            The display-mode target of the asset: light, dark, or browser-adaptive. For example, Amazon Cognito displays a dark-mode image only when the browser or application is in dark mode, but displays a browser-adaptive file in all contexts.

          • Extension (string) –

            The file type of the image file.

          • Bytes (bytes) –

            The image file, in Base64-encoded binary.

          • ResourceId (string) –

            The ID of the asset.

      • CreationDate (datetime) –

        The date and time when the item was created. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

      • LastModifiedDate (datetime) –

        The date and time when the item was modified. Amazon Cognito returns this timestamp in UNIX epoch time format. Your SDK might render the output in a human-readable format like ISO 8601 or a Java Date object.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException

  • CognitoIdentityProvider.Client.exceptions.ConcurrentModificationException

  • CognitoIdentityProvider.Client.exceptions.ManagedLoginBrandingExistsException

  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException

  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException

  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException

  • CognitoIdentityProvider.Client.exceptions.LimitExceededException

  • CognitoIdentityProvider.Client.exceptions.InternalErrorException