Skip to content

Commit b16e9b2

Browse files
authored
Merge pull request #14504 from guardian/ash/got-fixes
fix(google-one-tap): Use browser supported `atob` function to parse Base64
2 parents 099359f + bb5198b commit b16e9b2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

dotcom-rendering/src/components/GoogleOneTap.importable.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const extractEmailFromToken = (
6767
const payload = token.split('.')[1];
6868
if (!payload) return error('ParsingError');
6969
try {
70-
const decoded = Buffer.from(payload, 'base64').toString();
70+
const decoded = atob(payload);
7171
const parsed = JSON.parse(decoded) as unknown;
7272
if (!isObject(parsed) || typeof parsed.email !== 'string') {
7373
return error('ParsingError');
@@ -222,9 +222,7 @@ export const initializeFedCM = async ({
222222
});
223223

224224
if (credentials) {
225-
log('identity', 'FedCM credentials received', {
226-
credentials,
227-
});
225+
log('identity', 'FedCM credentials received');
228226

229227
const signInEmail = okOrThrow(
230228
extractEmailFromToken(credentials.token),

0 commit comments

Comments
 (0)