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

Updated to fix issues-4170 #7980

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mohankumarelec
Copy link

Description

Closes: #4170
This PR fixes the issue and adds feature of linkProviderUserInfo in auth emulator.

Scenarios Tested

  • should error if linkProviderUserInfo is missing required fields
  • should error if user is disabled when linking a provider

@joehan
Copy link
Contributor

joehan commented Nov 21, 2024

Note: Needs a CHANGELOG entry before merge.

@@ -1232,8 +1231,20 @@ export function setAccountInfoImpl(
}
}

if (reqBody.linkProviderUserInfo) {
if (!reqBody.linkProviderUserInfo.providerId?.length) {
throw new Error("providerId is required and must be a non-empty string.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should use assert to throw a client error instead of internal error, but I don't know what the correct error codes should be. Maybe we can settle with assert(condition, "TODO_ERROR_CODE : missing providerId") for now

.query({ key: "fake-api-key" })
.send({ idToken, linkProviderUserInfo: incompleteProviderUserInfo2 })
.catch((err) => {
expect(err.response.status).to.equal(500); // Expecting internal server error since it's a missing validation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, let's make this a 400

@yuchenshi
Copy link
Member

PTAL at the unit test failures and I can do another round of review after

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

Successfully merging this pull request may close these issues.

Request to add/link new provider to the account results in 501
3 participants