How to use the amplify-category-auth.add function in amplify-category-auth

To help you get started, weā€™ve selected a few amplify-category-auth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-cli / packages / amplify-category-storage / provider-utils / awscloudformation / service-walkthroughs / s3-walkthrough.js View on Github external
async function addWalkthrough(context, defaultValuesFilename, serviceMetadata, options) {
  while (!checkIfAuthExists(context)) {
    if (
      await context.amplify.confirmPrompt.run(
        'You need to add auth (Amazon Cognito) to your project in order to add storage for user files. Do you want to add auth now?'
      )
    ) {
      try {
        const { add } = require('amplify-category-auth');
        await add(context);
      } catch (e) {
        context.print.error('The Auth plugin is not installed in the CLI. You need to install it to use this feature');
        break;
      }
      break;
    } else {
      process.exit(0);
    }
  }
  const resourceName = resourceAlreadyExists(context);

  if (resourceName) {
    context.print.warning('Amazon S3 storage was already added to your project.');
    process.exit(0);
  } else {
    return await configure(context, defaultValuesFilename, serviceMetadata, undefined, options);
github aws-amplify / amplify-cli / packages / amplify-category-predictions / provider-utils / awscloudformation / prediction-category-walkthroughs / infer-walkthrough.js View on Github external
async function addWalkthrough(context) {
  while (!checkIfAuthExists(context)) {
    if (
      await context.amplify.confirmPrompt.run(
        'You need to add auth (Amazon Cognito) to your project in order to add storage for user files. Do you want to add auth now?'
      )
    ) {
      try {
        const { add } = require('amplify-category-auth');
        await add(context);
      } catch (e) {
        context.print.error('The Auth plugin is not installed in the CLI. You need to install it to use this feature');
        break;
      }
      break;
    } else {
      process.exit(0);
    }
  }

  return await configure(context);
}
github aws-amplify / amplify-cli / packages / amplify-category-predictions / provider-utils / awscloudformation / prediction-category-walkthroughs / identify-walkthrough.js View on Github external
async function addWalkthrough(context) {
  while (!checkIfAuthExists(context)) {
    if (
      await context.amplify.confirmPrompt.run(
        'You need to add auth (Amazon Cognito) to your project in order to add storage for user files. Do you want to add auth now?'
      )
    ) {
      try {
        const { add } = require('amplify-category-auth');
        await add(context);
      } catch (e) {
        context.print.error('The Auth plugin is not installed in the CLI. You need to install it to use this feature');
        break;
      }
      break;
    } else {
      process.exit(0);
    }
  }

  return await configure(context);
}
github aws-amplify / amplify-cli / packages / amplify-category-predictions / provider-utils / awscloudformation / prediction-category-walkthroughs / convert-walkthrough.js View on Github external
async function addWalkthrough(context) {
  while (!checkIfAuthExists(context)) {
    if (
      await context.amplify.confirmPrompt.run(
        'You need to add auth (Amazon Cognito) to your project in order to add storage for user files. Do you want to add auth now?'
      )
    ) {
      try {
        const { add } = require('amplify-category-auth');
        await add(context);
      } catch (e) {
        context.print.error('The Auth plugin is not installed in the CLI. You need to install it to use this feature');
        break;
      }
      break;
    } else {
      process.exit(0);
    }
  }

  return await configure(context);
}
github aws-amplify / amplify-cli / packages / amplify-category-predictions / provider-utils / awscloudformation / prediction-category-walkthroughs / interpret-walkthrough.js View on Github external
async function addWalkthrough(context) {
  while (!checkIfAuthExists(context)) {
    if (
      await context.amplify.confirmPrompt.run(
        'You need to add auth (Amazon Cognito) to your project in order to add storage for user files. Do you want to add auth now?'
      )
    ) {
      try {
        const { add } = require('amplify-category-auth');
        await add(context);
      } catch (e) {
        context.print.error('The Auth plugin is not installed in the CLI. You need to install it to use this feature');
        break;
      }
      break;
    } else {
      process.exit(0);
    }
  }

  return await configure(context);
}
github aws-amplify / amplify-cli / packages / amplify-category-api / provider-utils / awscloudformation / service-walkthroughs / appSync-walkthrough.js View on Github external
async function askUserPoolQuestions(context) {
  let authResourceName = checkIfAuthExists(context);

  if (!authResourceName) {
    try {
      const { add } = require('amplify-category-auth');

      authResourceName = await add(context);
    } catch (e) {
      context.print.error('Auth plugin not installed in the CLI. You need to install it to use this feature.');
    }
  } else {
    context.print.info('Use a Cognito user pool configured as a part of this project.');
  }

  return {
    authenticationType: 'AMAZON_COGNITO_USER_POOLS',
    userPoolConfig: {
      userPoolId: `auth${authResourceName}`,
    },
  };
}

amplify-category-auth

amplify-cli authentication plugin

Apache-2.0
Latest version published 2 years ago

Package Health Score

72 / 100
Full package analysis