标签: aws-amplify

通过 AWS Amplify 使用用户名或唯一电子邮件进行 Cognito 身份验证

使用 Cognito 用户池放大 CLI 身份验证目前有两种主要模式,使用用户名或电子邮件登录。在前一种情况下,电子邮件唯一性作为必需的用户属性没有被强制执行。

Cognito 服务本身支持“还允许使用经过验证的电子邮件地址登录”选项(AWS 控制台,用户池属性部分),但只能在创建用户池时进行设置(即以后无法修改 - 复选框已禁用)。是否可以在允许用户使用用户名或电子邮件进行身份验证的同时在用户池中强制执行无重复电子邮件?

总而言之,我的用例需要:

  • 通过 Amplify 注册用户时,在 Cognito 级别验证/强制执行电子邮件属性的唯一性Auth.SignUp
  • 保持基于用户名的登录,但也允许用户使用他们的电子邮件登录(即,Auth.SignIn使用电子邮件或用户名作为用户名参数提供)。

authentication amazon-web-services amazon-cognito aws-amplify aws-amplify-cli

9
推荐指数
1
解决办法
1087
查看次数

如何使用 Amplify iOS (AppSync) 存储关系(一对多或多对一)数据?

今天检查了一些放大文档(我知道这个文档说它是iOS场景中的预览)但我遇到了一个障碍。

假设

  1. 在我的 iOS 项目中正确配置了 Amplify。我可以将数据推送到Person并查询Amplify.API
  2. 该架构已定义为:
type Person @model {
  id: ID!
  name: String!
  possessions: [Thing] # list of things this person owns.
    @connection(keyName: "byPerson", fields: ["id"])
}

type Thing @model
           @key(name: "byPerson", fields: ["personId"]) {

  id: ID!
  name: String!
  personId: ID!
  ownerOfThings: Person # defining the 'belongsTo' property.
    @connection(fields: ["personId"])
}
Run Code Online (Sandbox Code Playgroud)

这将生成以下代码:

type Person @model {
  id: ID!
  name: String!
  possessions: [Thing] # list of things this person owns.
    @connection(keyName: "byPerson", …
Run Code Online (Sandbox Code Playgroud)

ios swift graphql aws-amplify amplify-ios

9
推荐指数
0
解决办法
1727
查看次数

How do I disable the sign up link for the aws amplify vue authenticator?

I'm using the amplify-authenticator component from the aws-amplify-vue library to enable authentication for my app. I'm trying to figure out how to disable the "Create Account" link on the front end and I can't seem to find anything in the documentation or online. I've seen a few places where users disabled it by hiding it with css and a few places where users were able to disable it with the react library, but I haven't found anything specific for the …

javascript typescript aws-amplify aws-amplify-vue

9
推荐指数
2
解决办法
4237
查看次数

如何使用 aws-amplify 验证节点/express 中的 accessToken?

我在前端 React 应用程序上使用 AWS amplify 进行用户身份验证。我的 React 应用程序直接与 amplify 通信,无需任何后端(节点服务器)交互。

我有一个用 node/express 编写的 REST API。我想使用放大来保护该 API。

目前,我计划将访问令牌从我的 React 应用程序传递到我的节点服务器。但是我无法找到一种方法来使用放大在后端验证此令牌。

aws-amplify 包是否提供任何可以传递访问令牌来验证它的功能?

就像是 Auth.verifyToken(<access_token>)

amazon-web-services node.js reactjs amazon-cognito aws-amplify

9
推荐指数
2
解决办法
4519
查看次数

自定义电子邮件验证页面 AWS Cognito

我正在使用 Amazon Cognito 进行用户身份验证。用户注册后,验证电子邮件将发送到他的电子邮件地址。单击电子邮件链接后,他会在浏览器中收到提示。

Aws 验证页面

我如何自定义此页面以插入将触发移动应用程序中的深层链接的脚本,并使页面看起来更好一些?

amazon-web-services amazon-cognito aws-amplify aws-amplify-sdk-js

9
推荐指数
1
解决办法
2104
查看次数

AWS Amplify 构建设置

使用 Amplify 我在部署 React 应用程序时遇到困难,我认为这是由于构建设置造成的。尝试部署时提供的默认构建设置如下所示: aws构建设置

我知道这是不正确的,我在构建日志中发现的错误是:

2020-05-14T00:02:22.327Z [WARNING]: !! No index.html detected in deploy folder: /codebuild/output/src568504829/src/chatterfield/
Run Code Online (Sandbox Code Playgroud)

部署成功,除非我启动应用程序时收到 ERR_TOO_MANY_REDIRECTS。在我将baseDirectory构建设置更改为/client/public指向index.html. 该应用程序似乎启动时没有出现重定向错误,但没有加载任何内容。我猜这是因为我没有运行 npm run build 命令,或者没有加载预构建命令。任何帮助将不胜感激。谢谢 这是此应用程序链接到的存储库: https ://github.com/travelerr/chatterfield

deployment amazon-web-services build-settings npm aws-amplify

9
推荐指数
3
解决办法
8109
查看次数

WebStorm 和 aws-amplify 的未声明指令错误

我正在使用 WebStorm 进行开发并使用 React Native 应用程序。我使用 GraphQL,但是,IDE 不断出现多个错误:

试图使用未声明的指令

解析时不存在字段类型“AWSDateTime”

关于配置选项的任何建议?

webstorm aws-amplify

9
推荐指数
0
解决办法
256
查看次数

AWS Auth 更新失败卡在 UPDATE_ROLLBACK_FAILED 状态

我已将谷歌登录添加到我的应用程序中并尝试推送修改,但我没有权限这样做。获得权限后,我尝试放大推送,但出现此错误:

Stack:arn:aws:cloudformation:us-east-1:432853258441:stack/amplify-huruproject-local-190356/117b7360-c94d-11eb-a4cc-0e8a861a6983 is in UPDATE_ROLLBACK_FAILED state and can not be updated.
Run Code Online (Sandbox Code Playgroud)

推送操作期间发生错误:Stack:arn:aws:cloudformation:us-east-1:432853258441:stack/amplify-huruproject-local-190356/117b7360-c94d-11eb-a4cc-0e8a861a6983 处于 UPDATE_ROLLBACK_FAILED 状态,无法被更新。

问题是我在堆栈控制台中找不到这个特定的堆栈。我怎样才能解决这个问题?更新:我找到了堆栈,它位于自动生成的嵌套堆栈中。这是我发现的: 在此输入图像描述

在此输入图像描述 在此输入图像描述

我不知道如何从这里继续。我应该删除整个堆栈吗?我会丢失所有数据吗?

android amazon-web-services google-signin aws-amplify

9
推荐指数
2
解决办法
9535
查看次数

使用 nextToken 的 AppSync GraphQL 查询

我的schema.graphql文件graphql/queries.js通过运行amplify push命令在文件中自动生成以下查询。

这是自动生成查询的架构文件。

模式.graphql

type User @model {
  id: String!
  uuid: String!
  following: [String]
  follower: [String]
  posts: [Post] @connection(name: "Userposts", sortField: "createdAt")
}

type Post 
  @model
  @auth(
    rules: [
      { allow: owner },
      { allow: groups, groups: ["Admin"] }
    ]
  ) {
  id: ID!
  author: User! @connection(name: "Userposts")
  status: Status!
  draft: Boolean
  content: AWSJSON!
  loved: [String]
  comments: [Comment] @connection(name: "PostComments", sortField: "createdAt")
  createdAt: AWSDateTime
    updatedAt: AWSDateTime
}

enum Status {
  PRIVATE
  PUBLIC
}
Run Code Online (Sandbox Code Playgroud)

这是模式 …

graphql aws-appsync aws-amplify

8
推荐指数
1
解决办法
5120
查看次数

AWS AppSync + React-Apollo Query/useQuery 引发异常 this.currentObservable.query.getCurrentResult 不是函数

我是 GraphQL/Apollo 的新手,我很难用 React 应用程序设置它。

我有一个 React 组件,它从使用 Amplify/AppSync 构建的 GraphQL API 加载列表。

如果我手动调用以获取项目,即:

    const videosData = await client.query({
      query: gql(queries.listVideos)
    });
    const videosItems = videosData.data.listVideos.items;
    setVideosData(videosItems);

Run Code Online (Sandbox Code Playgroud)

奇迹般有效。但是,如果我尝试使用 Apollo Query 组件或 useQuery 挂钩,则会引发以下错误:

类型错误:this.currentObservable.query.getCurrentResult 不是函数

如果我只是添加行来使用钩子获取查询,它已经给了我这个错误

钩子调用:

const {loading, error, data, refetch} = useQuery(gql(queries.listVideos));
Run Code Online (Sandbox Code Playgroud)

引发问题的被调用函数:

QueryData.getQueryResult
node_modules/@apollo/react-hooks/lib/react-hooks.esm.js:325
  322 |     called: true
  323 |   });
  324 | } else {
> 325 |   var currentResult = this.currentObservable.query.getCurrentResult();
      | ^  326 |   var loading = currentResult.loading,
  327 |       partial = currentResult.partial,
  328 …
Run Code Online (Sandbox Code Playgroud)

reactjs graphql react-apollo aws-appsync aws-amplify

8
推荐指数
2
解决办法
3580
查看次数