firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

FR: Surface auth credentials in `auth/admin-restricted-operation` error

Open brettwillis opened this issue 1 year ago • 0 comments

Firebase SDK Version

10.7.2

Describe the problem

As per the lines below, the response auth credentials are already surfaced for FEDERATED_USER_ID_ALREADY_LINKED errors so that the credential can be linked in a following operation.

https://github.com/firebase/firebase-js-sdk/blob/895d0cf981068cbfb74c40ac0e87b4e46096fdc1/packages/auth/src/api/index.ts#L191-L196

Now that there is a new setting to disable self-service user account creation, when a user signs in auth a federated provider when there is no existing account, then we get an ADMIN_ONLY_OPERATION error.

In such a case, we may want to initiate account creation via our own (admin) backend, and thereupon link the credentials to our new account. However this is currently impossible because the credentials are not surfaced.

Let's get the user credentials response surfaced with the error for ADMIN_ONLY_OPERATION in the same way as FEDERATED_USER_ID_ALREADY_LINKED?

brettwillis avatar Jan 24 '24 07:01 brettwillis