def get_amplify_cookie_names(client_id, cookies_or_username):
    """Return mapping dict for cookie names for amplify."""
    key_prefix = f"CognitoIdentityServiceProvider.{client_id}"
    last_user_key = f"{key_prefix}.LastAuthUser"
    if isinstance(cookies_or_username, str):
        token_user_name = cookies_or_username
    else:
        token_user_name = cookies_or_username.get(last_user_key)
    return {
        "last_user_key": last_user_key,
        "user_data_key": f"{key_prefix}.{token_user_name}.userData",
        "scope_key": f"{key_prefix}.{token_user_name}.tokenScopesString",
        "id_token_key": f"{key_prefix}.{token_user_name}.idToken",
        "access_token_key": f"{key_prefix}.{token_user_name}.accessToken",
        "refresh_token_key": f"{key_prefix}.{token_user_name}.refreshToken",
    }