Skip to main content

Type Alias: InitializeAWS()

InitializeAWS = (cognitoConfig, s3Config, appSyncConfig) => Promise<void>

Function

Initializes the authentication module with AWS Cognito, S3, and AppSync configurations.

In most implementations using <mmq-auth> or <mmq-embed> components, this initialization is handled automatically using the global window.mimeeqEmbedEnv configuration. Direct calls to this method are typically only needed for custom implementations.

Parameters

cognitoConfig

AuthOptions

Parameters for authentication with AWS Cognito

s3Config

Nullable<S3Options>

Configuration for S3 storage service, or null if not needed

appSyncConfig

Nullable<AppSyncConfig>

Configuration for AppSync GraphQL API, or null if not needed

Returns

Promise<void>

A promise that resolves when initialization is complete

Example

// Standard usage with mmq-auth component (initialization happens automatically):
// <mmq-auth short-code="your-short-code"></mmq-auth>

// For custom implementations, you can use the global environment config:
const { cognitoConfig, s3Config, appSyncConfig } = window.mimeeqEmbedEnv;
window.mimeeqAuth.initialize(cognitoConfig, s3Config, appSyncConfig);

// Or provide your own configuration:
window.mimeeqAuth.initialize({
userPoolId: 'us-east-1_xxxxxxxx',
identityPoolId: 'us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
userPoolClientId: 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
region: 'us-east-1'
}, {
bucket: 'my-mimeeq-assets'
}, {
endpoint: 'https://xxxxxxxxxx.appsync-api.us-east-1.amazonaws.com/graphql'
});