Skip to content
Prev Previous commit
Next Next commit
review nits
  • Loading branch information
rsgowman committed Feb 4, 2021
commit 40e00601ce8e370daca4ef5a909e03c6ebfd63cb
10 changes: 5 additions & 5 deletions src/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,22 +197,22 @@ export class BaseAuth<T extends AbstractAuthRequestHandler> implements BaseAuthI
*
* @param providerId The provider ID, for example, "google.com" for the
* Google provider.
* @param providerUid The user identifier for the given provider.
* @param uid The user identifier for the given provider.
*
* @return A promise fulfilled with the user data corresponding to the
* given provider id.
*/
public getUserByProviderUid(providerId: string, providerUid: string): Promise<UserRecord> {
public getUserByProviderUid(providerId: string, uid: string): Promise<UserRecord> {
// Although we don't really advertise it, we want to also handle
// non-federated idps with this call. So if we detect one of them, we'll
// reroute this request appropriately.
if (providerId === 'phone') {
return this.getUserByPhoneNumber(providerUid);
return this.getUserByPhoneNumber(uid);
} else if (providerId === 'email') {
return this.getUserByEmail(providerUid);
return this.getUserByEmail(uid);
}

return this.authRequestHandler.getAccountInfoByFederatedUid(providerId, providerUid)
return this.authRequestHandler.getAccountInfoByFederatedUid(providerId, uid)
.then((response: any) => {
// Returns the user record populated with server response.
return new UserRecord(response.users[0]);
Expand Down
6 changes: 3 additions & 3 deletions src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1517,19 +1517,19 @@ export namespace auth {
getUserByPhoneNumber(phoneNumber: string): Promise<UserRecord>;

/**
* Gets the user data for the user corresponding to a given provider id.
* Gets the user data for the user corresponding to a given provider ID.
*
* See [Retrieve user data](/docs/auth/admin/manage-users#retrieve_user_data)
* for code samples and detailed documentation.
*
* @param providerId The provider ID, for example, "google.com" for the
* Google provider.
* @param providerUid The user identifier for the given provider.
* @param uid The user identifier for the given provider.
*
* @return A promise fulfilled with the user data corresponding to the
* given provider id.
*/
getUserByProviderUid(providerId: string, providerUid: string): Promise<UserRecord>;
getUserByProviderUid(providerId: string, uid: string): Promise<UserRecord>;

/**
* Gets the user data corresponding to the specified identifiers.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ describe('admin.auth', () => {
.should.eventually.be.rejected.and.have.property('code', 'auth/user-not-found');
});

it('getUserByProviderUid() fails when called with a non-existing federated id', () => {
it('getUserByProviderUid() fails when called with a non-existing provider id', () => {
return admin.auth().getUserByProviderUid('google.com', nonexistentUid)
.should.eventually.be.rejected.and.have.property('code', 'auth/user-not-found');
});
Expand Down