Skip to content

[Gen2 Auth] can not add multiple auth providers. Got 'supportedLoginProviders' failed to satisfy constraint: Member must have length less than or equal to 128' #2032

@vkurniavka

Description

@vkurniavka

Environment information

System:
  OS: Windows 11 10.0.22631
  CPU: (22) x64 Intel(R) Core(TM) Ultra 9 185H
  Memory: 6.35 GB / 31.37 GB
Binaries:
  Node: 20.17.0 - ~\AppData\Local\Temp\yarn--1726772121413-0.3209963096971373\node.CMD
  Yarn: 1.22.22 - ~\AppData\Local\Temp\yarn--1726772121413-0.3209963096971373\yarn.CMD
  npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.3.1
  @aws-amplify/backend: 1.2.2
  @aws-amplify/backend-auth: 1.1.5
  @aws-amplify/backend-cli: 1.2.7
  @aws-amplify/backend-data: 1.1.4
  @aws-amplify/backend-deployer: 1.1.3
  @aws-amplify/backend-function: 1.4.1
  @aws-amplify/backend-output-schemas: 1.2.0
  @aws-amplify/backend-output-storage: 1.1.2
  @aws-amplify/backend-secret: 1.1.2
  @aws-amplify/backend-storage: 1.1.3
  @aws-amplify/cli-core: 1.1.3
  @aws-amplify/client-config: 1.3.1
  @aws-amplify/deployed-backend-client: 1.4.1
  @aws-amplify/form-generator: 1.0.2
  @aws-amplify/model-generator: 1.0.7
  @aws-amplify/platform-core: 1.1.0
  @aws-amplify/plugin-types: 1.2.2
  @aws-amplify/sandbox: 1.2.2
  @aws-amplify/schema-generator: 1.2.3
  aws-amplify: 6.6.2
  aws-cdk: 2.159.0
  aws-cdk-lib: 2.159.0
  typescript: 5.6.2
AWS environment variables:
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
  AWS_STS_REGIONAL_ENDPOINTS = regional
No CDK environment variables
Done in 10.72s.

Describe the bug

I want to add Google and Facebook login providers to my amplify auth.
and looks like there not possible to add both of them, because configuration handle only 128 character, but my one has 133 for google and facebook. So I can not add both providers, even if I add one then another I got the same issue

validation error detected: Value '{accounts.google.com=************-********************************.apps.googleusercontent.com, graph.facebook.com=**************** }' at 'supportedLoginProviders' failed to satisfy constraint: Map value must satisfy constraint: [Member must have length less than or equal to 128, Member must have length greater than or equal to 1, Member must satisfy regular expression pattern: [\w.;_/-]+] (Service: CognitoIdentity, Status Code: 400,

Reproduction steps

use this amplify/auth/resource.ts provide real secrets and try to deploy app

import { defineAuth, secret } from "@aws-amplify/backend";

/**
 * Define and configure your auth resource
 * @see https://docs.amplify.aws/gen2/build-a-backend/auth
 */
export const auth = defineAuth({
  loginWith: {
    email: true,
    externalProviders: {
      google: {
        clientId: secret("GOOGLE_CLIENT_ID"),
        clientSecret: secret("GOOGLE_CLIENT_SECRET"),
        scopes: ["email", "profile", "openid"],
        attributeMapping: {
          email: "email",
          familyName: "family_name",
          givenName: "given_name",
          fullname: "name",
        },
      },
      facebook: {
        clientId: secret("FACEBOOK_CLIENT_ID"),
        clientSecret: secret("FACEBOOK_CLIENT_SECRET"),
        scopes: ["email", "public_profile"],
        attributeMapping: {
          email: "email",
          familyName: "last_name",
          givenName: "first_name",
          fullname: "name",
        },
      },
      callbackUrls: [
        "http://localhost:3000"
      ],
      logoutUrls: [
        "http://localhost:3000/auth/login"
      ],
    },
  },
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    authIssue pertaining to Amplify Authpending-triageIncoming issues that need categorization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions