Skip to content

Commit ae884e9

Browse files
author
Robert-Jan Huijsman
authored
Merge pull request #58 from firebase/rjh.remove-auth-shim
Remove the Auth UID reformatting shim
2 parents e6c3154 + 15eb709 commit ae884e9

File tree

2 files changed

+0
-40
lines changed

2 files changed

+0
-40
lines changed

spec/providers/auth.spec.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -146,33 +146,5 @@ describe('AuthBuilder', () => {
146146

147147
return expect(cloudFunction(event)).to.eventually.deep.equal(event.data);
148148
});
149-
150-
it('should reformat a url-formatted UID', () => {
151-
const cloudFunction = auth.user().onCreate((ev: Event<firebase.auth.UserRecord>) => ev.data);
152-
let event: Event<firebase.auth.UserRecord> = {
153-
data: {
154-
uid: 'http://github.com/abcde12345',
155-
},
156-
} as any;
157-
return expect(cloudFunction(event)).to.eventually.deep.equal(
158-
{
159-
uid: 'abcde12345',
160-
},
161-
);
162-
});
163-
164-
it('should not reformat legally-formatted UIDs', () => {
165-
const cloudFunction = auth.user().onCreate((ev: Event<firebase.auth.UserRecord>) => ev.data);
166-
let event: Event<firebase.auth.UserRecord> = {
167-
data: {
168-
uid: 'abcde12345',
169-
},
170-
} as any;
171-
return expect(cloudFunction(event)).to.eventually.deep.equal(
172-
{
173-
uid: 'abcde12345',
174-
},
175-
);
176-
});
177149
});
178150
});

src/providers/auth.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,6 @@ export class UserBuilder {
5151
}
5252
}
5353

54-
// It is possible that the incoming UID is formatted as a URL, for example: "http://github.com/12345".
55-
// That format would break our spec, since...
56-
// - The Admin SDK would return a UserRecord with a UID of just "12345".
57-
// - The UserRecord UID is supposed to be usable as a key in the Firebase Realtime Database, which is
58-
// impossible with this slash-based format.
59-
// Hence, we'll re-format the UID here, if it was indeed supplied as a URL.
60-
// We won't use string.split(), since it's not available on older versions of node.
61-
// BUG(36486645)
62-
if (raw.data.uid) {
63-
raw.data.uid = raw.data.uid.substring(raw.data.uid.lastIndexOf('/') + 1);
64-
}
65-
6654
return raw.data;
6755
}
6856

0 commit comments

Comments
 (0)