aws-amplify

How to get and update user attributes AWS amplify angular 6

三世轮回 提交于 2019-12-06 07:47:32
问题 How would I change the attributes of the Cognito user after sign up into the application? What API should be used to fetch the details of the user like First Name, Last Name etc? What API should be used to update the user details? 回答1: To fetch the details of the user, simply use this.amplifyService.auth().currentAuthenticatedUser() and retrieve the user.attributes fields. /** * Get current authenticated user * @return - A promise resolves to curret authenticated CognitoUser if success */

Running Lambda functions for server-side validation with AppSync and DynamoDB

爱⌒轻易说出口 提交于 2019-12-06 03:40:29
I've enjoyed working with AWS Amplify a lot lately, its code generation for GraphQL queries based on defined schema is outstanding. I came across one complication for defining custom logic / validation server-side. Out of the bag AppSync (part responsible for GraphQL api in Amplify) generates resolvers and DynamoDB tables for your schema. Resolvers are created using Apache Velocity templating language and if you are new to it, its a bit of a learning curve in my opinion. Furthermore, these resolvers are auto generated by Amplify cli. I'm not sure if editing them makes sense either in AppSync

Restrict login to Enterprise Google Domain for AWS Federated Identity Pool

喜你入骨 提交于 2019-12-04 16:24:42
I'm using a federation identity pools with aws-amplify ( https://aws.github.io/aws-amplify/media/authentication_guide#enabling-federated-identities ) and I'd like to restrict the scope of domains to just my google domain organization (ex. johndoe@foobar.com). There doesn't seem to be a way to lock it down on either the Google API console or the AWS Cognito Identity Pool settings, just a hint that an hd parameter can be appended to the google request to restrict it by domain (which would still require modifying the aws-amplify core package), and it still wouldn't be secure since anyone could

aws-amplify subscription to appsync stops after 2 mins

一世执手 提交于 2019-12-03 08:27:07
When subscribing to appsync using amplify using API.graphql(graphqlOperation(subscription)); the subscription works for a while, but the I get socket closed error. CONSOLE LOG [native code]: { "[INFO] 24:12.893 MqttOverWSProvider": { "errorCode": 8, "errorMessage": "AMQJS0008I Socket closed.", "uri": "wss://<uri> The same subscription works in the appsync console without any issue and I get events as long as the subscription is running, but stops after around 2 mins on device. code involved let cs = await this.subscriptionService.appSubscriptions(); this.sbscriptions = this.cs.subscribe({ next

AWS Cognito/Amplify - have new user sign ups be automatically add to a user group

六眼飞鱼酱① 提交于 2019-11-30 11:55:50
问题 I am using AWS Amplify library to sign up and perform Auth for an AppSync project. This uses Cognito. However, when a new user signs up via Amplify/Cognito, the new user isn't assigned to any specific group in the cognito pool. I am using the Amplify higher order component for login/signup. import { withAuthenticator } from 'aws-amplify-react'; which I wrap over a component class Authenticator extends React.Component { //... basically empty component, only exists so I can wrap it w/ the HOC }

AppSync: Get user information in $context when using AWS_IAM auth

一笑奈何 提交于 2019-11-30 02:14:59
In AppSync, when you use Cognito User Pools as your auth setting your identity you get identity: { sub: 'bcb5cd53-315a-40df-a41b-1db02a4c1bd9', issuer: 'https://cognito-idp.us-west-2.amazonaws.com/us-west-2_oicu812', username: 'skillet', claims: { sub: 'bcb5cd53-315a-40df-a41b-1db02a4c1bd9', aud: '7re1oap5fhm3ngpje9r81vgpoe', email_verified: true, event_id: 'bb65ba5d-4689-11e8-bee7-2d0da8da81ab', token_use: 'id', auth_time: 1524441800, iss: 'https://cognito-idp.us-west-2.amazonaws.com/us-west-2_oicu812', 'cognito:username': 'skillet', exp: 1524459387, iat: 1524455787, email: 'myemail@nope.com'

How to retrieve currentUser data with Vue.js, AWS Amplify, and MongoDB

旧时模样 提交于 2019-11-27 08:43:37
问题 I am attempting to build a Vue.js App that synthesizes properties of AWS, MongoDB, and Express. I built an authentication page for the app using aws-amplify and aws-amplify-vue . After logging into the app, metadata containing the username for the logged in AWS user is passed into data object property this.name like so: async beforeCreate() { let name = await Auth.currentAuthenticatedUser() this.name = name.username } this.name is then added to MongoDB via Axios: async addName() { let uri =