diff --git a/packages/sdk-auth/src/auth.js b/packages/sdk-auth/src/auth.js index 9265d65b3..3bf0e6d55 100644 --- a/packages/sdk-auth/src/auth.js +++ b/packages/sdk-auth/src/auth.js @@ -88,7 +88,8 @@ export default class SdkAuth { clientId, clientSecret, }: ClientAuthOptions): string { - return Buffer.from(`${clientId}:${clientSecret}`).toString('base64') + const targetStr = `${clientId}:${clientSecret}`; + return typeof Buffer === 'undefined' ? btoa(targetStr) : Buffer.from(targetStr).toString('base64'); } static _getScopes(scopes: ?Array, projectKey: ?string): string {