Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Attribute required during google authentication #54

Closed
railsstudent opened this issue Dec 13, 2017 · 14 comments
Closed

Attribute required during google authentication #54

railsstudent opened this issue Dec 13, 2017 · 14 comments

Comments

@railsstudent
Copy link

I have a Cognito user pool where email and phone number are required attributes.
When using oauth code grant flow for google authentication, the oauth callback receives error message "attributes required: phone_number"

The gmail account has phone number and I also map google attribute phoneNumbers to Phone Number user pool attribute.

Please advise how to resolve the error. Thanks.

Connie

@ashwindevendran
Copy link

ashwindevendran commented Dec 14, 2017

Hi,

In your user pool do you require PhoneNumber to be verified (this information will be helpful in debugging the issue).

-Ashwin

@railsstudent
Copy link
Author

@ashwindevendran Yes, the phonenumber is a required attribute in user pool
The user pool was created for authentication without federation in mind.
Now, my company wants to use google login and prefer to reuse the existing user pool.
However, the required attribute is making it impossible.

Thanks,

Connie

@jonasao
Copy link

jonasao commented Dec 15, 2017

A user's phone number is out of scope when authenticating using Google as federated identity. You will probably have to fetch this manually, and add it to the data returned when the user is authenticating.

@railsstudent
Copy link
Author

railsstudent commented Dec 15, 2017

How can I do it?
The hosted UI does not have a place for user to input phone number.
Then google authentication redirects to callback url with error query parameter
Can I pass a dummy phone number to authorize endpoint?

@jonasao
Copy link

jonasao commented Dec 15, 2017

I am not sure, but maybe a pre-authentication Lambda will help you to set the user as verified without adding a valid phone number.

http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html

@ashwindevendran
Copy link

Hi,

@jonasao is correct, it is not within scope for Google Sign-in (https://developers.google.com/identity/protocols/googlescopes#google_sign-in)

Assuming you would like to keep the existing user pool and not migrate to a new one that does not have phone-number as a required attribute:
We will look into a long term solution for this, in the meantime you will have to obtain that information beforehand for the user (a trigger would be one such way).

@railsstudent
Copy link
Author

railsstudent commented Dec 21, 2017

@ashwindevendran Which trigger should i implement to pass the phone number?

I have a pre-signup trigger in cognito user pool that links google account to an existing user in user pool. The existing user already has phone number yet the same error message is shown.

The pre-signup trigger is never fired.

Please advise. Thanks

@yuntuowang
Copy link
Contributor

Hi @railsstudent, I think you should implement Pre authentication trigger.

For more info, please see here: http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html

@railsstudent
Copy link
Author

@yuntuowang I implemented pre authentication trigger that only does a simple console.log.
The trigger is not called and the same error message , attributes required: [phone_number], is returned.

@railsstudent
Copy link
Author

@jonasao @yuntuowang Is there no workaround other than creating new user pool where phone number is not a required attribute?
If this is the case, I need to discuss with my supervisor. Thanks.

@yuntuowang
Copy link
Contributor

@railsstudent You are correct. An attribute cannot be switched between required and not required after a user pool has been created.
Details here: http://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html

@viirak
Copy link

viirak commented Aug 20, 2019

Hi, have this issue been resolved. I am having exactly the same situation here.

@narindermalik2
Copy link

Getting the same issue. Has anyone found any solution?

@trongnsy
Copy link

trongnsy commented Feb 3, 2020

I am having the exact same issue. Seems like there is no trigger to intercept and fill into the blanks
Anyone came up with a solution?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants