我在我的笔记本电脑上安装了 amplify cli,尽管它抛出了错误,但我还是使用了该amplify configure命令并且它有效。但现在,当我尝试在另一台笔记本电脑上执行相同的操作时,它会抛出错误“-bash:amplify:找不到命令”。以下是整个错误块:
npm WARN deprecated @types/ora@3.2.0: This is a stub types definition. ora provides its own type definitions, so you do not need this installed.
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/Users/.npm-global/bin/amplify -> /Users/.npm-global/lib/node_modules/@aws-amplify/cli/bin/amplify
> snappy@5.0.5 install /Users/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/snappy
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/snappy/build'
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/.npm-global/lib/node_modules/@aws-amplify/cli/node_modules/snappy
gyp ERR! node -v v10.16.3 …Run Code Online (Sandbox Code Playgroud) 使用 Cognito 用户池放大 CLI 身份验证目前有两种主要模式,使用用户名或电子邮件登录。在前一种情况下,电子邮件唯一性作为必需的用户属性没有被强制执行。
Cognito 服务本身支持“还允许使用经过验证的电子邮件地址登录”选项(AWS 控制台,用户池属性部分),但只能在创建用户池时进行设置(即以后无法修改 - 复选框已禁用)。是否可以在允许用户使用用户名或电子邮件进行身份验证的同时在用户池中强制执行无重复电子邮件?
总而言之,我的用例需要:
Auth.SignUp;Auth.SignIn使用电子邮件或用户名作为用户名参数提供)。authentication amazon-web-services amazon-cognito aws-amplify aws-amplify-cli
目前,我正在尝试使用Cognito Aws Service为我的网络应用程序实现社交登录。但我不想将用户重定向到 Cognito托管 UI进行社交登录。
所以我使用react-google-login作为Google登录,并且我也获得了回调访问令牌
<GoogleLogin
clientId="xxxxxxxxxxxxxx.apps.googleusercontent.com"
buttonText="Login"
onSuccess={this.responseGoogle}
onFailure={this.responseGoogleFailure}
cookiePolicy={'single_host_origin'}
/>
responseGoogle = async (response) => {
console.log("response..........", response);
const user = {
name: response.profileObj.name,
email: response.profileObj.email
};
let expires_at = 3600 * 1000 + new Date().getTime()
Auth.federatedSignIn('google', { token: response.tokenId, expires_at }, user).then(credentials => {
console.log(credentials);
});
}
Run Code Online (Sandbox Code Playgroud)
上面的代码给出了 Cognito 会话值,但不会在用户池中创建用户。
我进行了很多搜索,但没有找到任何解决方案。我已经在下面的链接中提到了它涉及我的问题。基本上我不想为 SocialLogin 使用托管 UI。
预先感谢
今天检查了一些放大文档(我知道这个文档说它是iOS场景中的预览)但我遇到了一个障碍。
假设
Person并查询Amplify.APItype 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) 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 …
在AWS Amplify的存储文档中,有一节介绍如何获取其他用户的对象......
Storage.get('test.txt', {
level: 'protected',
identityId: 'xxxxxxx' // the identityId of that user
})
Run Code Online (Sandbox Code Playgroud)
在哪里可以获取其他用户的identityId?
我只能查询用户的 Cognito 用户池 ID。有没有办法将用户池 ID 映射到身份 ID?
我正在使用此 Amplify 指南https://aws-amplify.github.io/docs/js/tutorials/building-react-native-apps/#connect-to-your-backend-1并且当我使用创建 API 时“aplify add api”应用程序失败。我正在使用“expo”,我正在使用 IphoneX 进行测试阶段。
我的应用程序代码是
import React, { Component } from 'react';
import { StyleSheet, Text, Button, View, Alert } from 'react-native';
import Amplify, { API } from 'aws-amplify';
import amplify from './aws-exports';
import awsmobile from './aws-exports';
import { withAuthenticator } from 'aws-amplify-react-native';
Amplify.configure(amplify);
Amplify.configure(awsmobile);
state = { apiResponse: null };
class App extends Component {
async getSample() {
const path = "/items"; // you can specify the path
const apiResponse = await …Run Code Online (Sandbox Code Playgroud) 我在前端 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
我正在使用 Amazon Cognito 进行用户身份验证。用户注册后,验证电子邮件将发送到他的电子邮件地址。单击电子邮件链接后,他会在浏览器中收到提示。
我如何自定义此页面以插入将触发移动应用程序中的深层链接的脚本,并使页面看起来更好一些?
amazon-web-services amazon-cognito aws-amplify aws-amplify-sdk-js
我正在使用 WebStorm 进行开发并使用 React Native 应用程序。我使用 GraphQL,但是,IDE 不断出现多个错误:
试图使用未声明的指令
解析时不存在字段类型“AWSDateTime”
关于配置选项的任何建议?
aws-amplify ×10
node.js ×3
reactjs ×3
javascript ×2
amplify-ios ×1
graphql ×1
ios ×1
npm ×1
npm-install ×1
react-native ×1
swift ×1
typescript ×1
webstorm ×1