diff --git a/packages/amplify-appsync-simulator/src/utils/auth-helpers/helpers.ts b/packages/amplify-appsync-simulator/src/utils/auth-helpers/helpers.ts index 5f37fcebc6c..9dfa0eba3ac 100644 --- a/packages/amplify-appsync-simulator/src/utils/auth-helpers/helpers.ts +++ b/packages/amplify-appsync-simulator/src/utils/auth-helpers/helpers.ts @@ -28,7 +28,11 @@ export function extractJwtToken(authorization: string): JWTToken { export function isValidOIDCToken(token: JWTToken, configuredAuthTypes: AmplifyAppSyncAuthenticationProviderConfig[]): boolean { const oidcIssuers = configuredAuthTypes .filter(authType => authType.authenticationType === AmplifyAppSyncSimulatorAuthenticationType.OPENID_CONNECT) - .map((auth: AmplifyAppSyncAuthenticationProviderOIDCConfig) => auth.openIDConnectConfig.Issuer); + .map((auth: AmplifyAppSyncAuthenticationProviderOIDCConfig) => + auth.openIDConnectConfig.Issuer && auth.openIDConnectConfig.Issuer.endsWith('/') + ? auth.openIDConnectConfig.Issuer.substring(0, auth.openIDConnectConfig.Issuer.length - 1) + : auth.openIDConnectConfig.Issuer, + ); return oidcIssuers.length > 0 && oidcIssuers.includes(token.iss); }