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

Document Client Metadata for Auth APIs #1289

Open
miguelflores1993 opened this issue Jan 21, 2022 · 5 comments
Open

Document Client Metadata for Auth APIs #1289

miguelflores1993 opened this issue Jan 21, 2022 · 5 comments
Labels
auth Issues related to the Auth Category Documentation Improvements or fixes to public documentation (docs.amplify.aws, pub.dev, readmes). feature-request A request for a new feature or an enhancement to an existing API or category. good first issue Good for newcomers

Comments

@miguelflores1993
Copy link

I want to send parameters or custom data apart from what the function asks me for.

Amplify.Auth.signIn

image

@Jordan-Nelson Jordan-Nelson added auth Issues related to the Auth Category question A question about the Amplify Flutter libraries labels Jan 21, 2022
@Jordan-Nelson
Copy link
Member

Hello @miguelflores1993 - Assuming you are using Cognitio, you can use CognitoSignUpOptions in place of SignUpOptions. CognitoSignUpOptions allows you to pass in Cognito User Attributes (email, phone, name, address, etc.) and any arbitrary client metadata that you would like to include. The client metadata will be available in lambda triggers (post auth trigger in this case).

await Amplify.Auth.signUp(
  username: username,
  password: password,
  options: CognitoSignUpOptions(
    // these values will be saved in Cognitio and associated with the user
    userAttributes: {
      CognitoUserAttributeKey.email: email,
      CognitoUserAttributeKey.name: 'name'
    },
    // available in post auth lambda triggers
    clientMetadata: {
      'foo': 'bar',
    },
  ),
);

@Jordan-Nelson
Copy link
Member

The docs have an example with user attributes under Register a User. Client metadata isn't mentioned in the amplify-flutter docs. I am going to label this as a docs issue as well.

@Jordan-Nelson Jordan-Nelson added the Documentation Improvements or fixes to public documentation (docs.amplify.aws, pub.dev, readmes). label Jan 21, 2022
@dorontal
Copy link

@Jordan-Nelson I tried to use userAttributes: { .. } as in the above code snippet but found no definition for CognitoUserAttributeKey.email - but I did find that CognitoUserAttributes.email works instead -CognitoUserAttributes is the correct one to use in the above code snippet, right?

@Jordan-Nelson
Copy link
Member

@dorontal - Yes that should be correct. The API was updated in (I think) v0.3.0. If you are using 0.2.10 or earlier I believe CognitoUserAttributes.email is correct.

@miguelflores1993 - Let me know if that answered your question, and I can update this issue to just track it as a documentation gap.

@Jordan-Nelson Jordan-Nelson removed the question A question about the Amplify Flutter libraries label Mar 11, 2022
@Jordan-Nelson Jordan-Nelson changed the title One question, send custom parameters by signIn Document Client Metadata for Auth APIs Mar 11, 2022
@Jordan-Nelson Jordan-Nelson added the good first issue Good for newcomers label Mar 11, 2022
@Jordan-Nelson
Copy link
Member

Marking as a documentation issue. We should add the client meta data option to https://github.com/aws-amplify/docs

@Jordan-Nelson Jordan-Nelson added the feature-request A request for a new feature or an enhancement to an existing API or category. label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues related to the Auth Category Documentation Improvements or fixes to public documentation (docs.amplify.aws, pub.dev, readmes). feature-request A request for a new feature or an enhancement to an existing API or category. good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants