Amplify-js: Pass custom attribute to Federated Signin

Created on 26 Sep 2020  路  5Comments  路  Source: aws-amplify/amplify-js

Which Category is your question related to?
Federated Signin

Amplify CLI Version
4.18.1

What AWS Services are you utilizing?
AWS Cognito

Provide additional details e.g. code snippets
I want to pass a custom attribute with the federated signin.
At the moment I am doing:
"Auth.federatedSignIn({ provider: "Google" })"

But I want to do something like this:
"Auth.federatedSignIn({ provider: "Google", 'custom:group': 'groupname' })"

Is it possible to do it?

What other options do I have if I want to assign a group to a user by passing the custom group name somehow?

Auth pending-close-response-required question

Most helpful comment

Hey there ! I am facing a situation that relates to this issue:

When a user signs up with Federated SignIn, I'd like to save the preferred locale using Cognito's locale attribute. Unfortunately, not all providers share the user's preferred locale. I'd like to be able to pass the preferred locale as a custom attribute:

Auth.federatedSignIn({
  provider: "Google",
  attributes: {
    locale: currentLocale
  }
});

Is there a way to achieve that ?

All 5 comments

@sammartinez this seems to be a library issue.

@bilalashraf1710

What you mention is not possible from the client.

For assigning the user to a group you will have to configure a lambda trigger. By default federated users are assign to a group with the provider name. If you are using Amplify cli you can take a look on Cognito lambda triggers section

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

Hey there ! I am facing a situation that relates to this issue:

When a user signs up with Federated SignIn, I'd like to save the preferred locale using Cognito's locale attribute. Unfortunately, not all providers share the user's preferred locale. I'd like to be able to pass the preferred locale as a custom attribute:

Auth.federatedSignIn({
  provider: "Google",
  attributes: {
    locale: currentLocale
  }
});

Is there a way to achieve that ?

I am also looking for a solution for this. I can possibly use updateUserAttributes after signup, but then I need one more signin to get an update access token from Cognito, that is less than ideal flow.

Was this page helpful?
0 / 5 - 0 ratings