如何使用Amplify将角度应用程序中的AWS-Cognito用户池更改为另一个用户池? [英] How to change AWS-Cognito user pools in an angular app to another user pool, using Amplify?

查看:180
本文介绍了如何使用Amplify将角度应用程序中的AWS-Cognito用户池更改为另一个用户池?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前正在使用角度应用程序.我正在尝试使用Cognito作为身份验证服务. 在我的VCode终端中,并使用Amplify CLI,我创建了用户池,并且如文档所述,Amplify创建了aws-export.js文件.在AWS帐户中,我可以检查从终端创建的所有设置 这是通过放大插入我的应用程序文件夹结构中的aws-export.js文件

Currently working in an angular app. I am trying to use Cognito as authentication service. From my terminal in VCode and using Amplify CLI I created the user pool and as the documentation says , Amplify created a aws-export.js file. In AWS account I was able to check all the settings created from my terminal Here is the aws-export.js file inserted in my app folder structure by amplify

const awsmobile = {
    "aws_project_region": "us-east-2",
    "aws_cognito_identity_pool_id": "us-east-2:THE_USER_POOL",
    "aws_cognito_region": "us-east-2",
    "aws_user_pools_id": "us-east-2_SOME_STRING",
    "aws_user_pools_web_client_id": "THE_CLIENT_ID_HERE",
    "oauth": {
        "domain": "A_STRING_SIMILAR_TO_USER_POOL-test.auth.us-east-2.amazoncognito.com",
        "scope": [
            "phone",
            "email",
            "openid",
            "profile",
            "aws.cognito.signin.user.admin"
        ],
        "redirectSignIn": "http://localhost:4200/",
        "redirectSignOut": "http://localhost:4200/login/",
        "responseType": "code"
    },
    "federationTarget": "COGNITO_USER_POOLS"
};
export default awsmobile;

现在,我希望同一应用程序从初始用户池更改为另一个区域中的另一个用户池,并且找不到放大命令来执行此操作.
AWS文档仅在最后步骤附近的结尾处提及 https://aws-amplify.github.io/docs/js/start?platform=angular 当存在AWS资源时,应手动修改main.ts文件.
那么aws-export.js不再有用吗?
是否可以将应用程序连接到没有后端的其他Cognito用户池?
我只想使用相同的角度应用程序并更改为另一个用户池,但仍然可以使用Amplify进行更改,例如可能更改重定向URL,但要使用Amplify.configure的更改,但要使用Amplify命令(推,拉,等)

Now I want same application to change from the initial user pool to another user pool in another region and cannot find any command in amplify to do that.
AWS doc only mention here at the end close to NEXT STEPS https://aws-amplify.github.io/docs/js/start?platform=angular that when AWS resource exist, the main.ts file should be modified manually.
So does the aws-export.js no longer is useful?
Are there ways to connect the app to different Cognito user pool that does not have a backend?
I only want to use same angular app and change to another user pool but still be able to use amplify for changes that I might need to add in the configuration of the Amplify.configure like changing redirect URLs but using amplify commands (push, pull, etc.)

推荐答案

这可能有点过分,但是我会创建一个默认区域设置为其他区域的新AWS配置文件.然后创建一个新环境 https://aws -amplify.github.io/docs/cli-toolchain/quickstart?sdk=js#concepts-1 .

This might be overkill, but I would create a new AWS profile with default region set to the other region. Then create a new environment https://aws-amplify.github.io/docs/cli-toolchain/quickstart?sdk=js#concepts-1.

这篇关于如何使用Amplify将角度应用程序中的AWS-Cognito用户池更改为另一个用户池?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆