Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating mutable user attributes #18

Closed
ChrisButterworth opened this issue Nov 22, 2017 · 9 comments
Closed

Updating mutable user attributes #18

ChrisButterworth opened this issue Nov 22, 2017 · 9 comments
Labels
feature-request Request a new feature

Comments

@ChrisButterworth
Copy link

Is there a way to update a way to update user attributes using this library?

Checked the documentation but doesn't mention anything about updating user attributes.

@richardzcode
Copy link
Contributor

We don't have this yet. In our backlog. We'll keep you posted.

@kbuechl
Copy link
Contributor

kbuechl commented Dec 5, 2017

@ChrisButterworth , I ran into this issue too and used something similar to this as a temporary work around.

import {
    CognitoUserAttribute
} from 'amazon-cognito-identity-js';

const updateAttributesExample = (attributeName, attributeValue) => {
    let user = getCurrentUser(dispatch);
    user.getSession((err, session) => {
        var disclaimerAttribute = [
            new CognitoUserAttribute({
                Name: attributeName,
                Value: attributeValue
            })
        ];

        user.updateAttributes(disclaimerAttribute, function (err, result) {
            if (err) {
                //handle the error
            }
            //do something with the success if needed
        });
    });
}

Edit: formatting

@mlabieniec mlabieniec added the feature-request Request a new feature label Dec 7, 2017
@asharafshahi
Copy link

Was this added recently? I'm also trying to update user attributes from my mobile react-native app. Thanks!

@mlabieniec
Copy link
Contributor

@asharafshahi it's in PR right now and should be in the next release!

@asharafshahi
Copy link

If I'm using aws-amplify-react-native will the next release address this for me as well?

@asharafshahi
Copy link

Thanks Amplify devs and @mlabieniec for getting the new release out! Looks like a lot of improvements. Sorry in advance if this should be obvious to me, but I looked through the docs to see what the new way to update user attributes is and I couldn't find it. A pointer would be much appreciated! thx

@yuyokk
Copy link
Contributor

yuyokk commented Feb 1, 2018

@asharafshahi I think that's what you are looking for https://github.com/aws/aws-amplify/blob/master/docs/media/authentication_guide.md#user-attributes

UPD: I believe there is a typo in the docs

it says

let result = await Auth.updateUserAttributes({
    'email': 'me@anotherdomain.com',
    'last_name': 'Lastname'
});

but from the source I see that updateUserAttributes(user, attributes) requires user to be passed in as well

@asharafshahi
Copy link

You are right, the docs definitely have a typo. I tried the method as stated in the docs and it throws an error. When I call Auth.currentAuthenticatedUser and pass the result in as the first argument all goes well.

@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

6 participants