logto-io / react-native

Logto React Native monorepo.
3 stars 3 forks source link

bug: After signing in, error thrown where `atob` doesn't exist #21

Closed alwyntan closed 5 months ago

alwyntan commented 8 months ago

Describe the bug

After signing in, error thrown where atob doesn't exist

Expected behavior

No error to be thrown and the idToken to be properly decoded on the frontend.

How to reproduce?

Install @logto/rn and set it up correctly, then run the signIn with a valid user.

Context

Screenshots

simulator_screenshot_99E82260-D3F8-49A2-B283-1E814759214D

alwyntan commented 8 months ago

React native should be adding the window.atob to hermes soon (expected in 0.74), as seen in https://github.com/facebook/hermes/issues/1178, but that will be a while.

A known approach to fix this for now is to use the Base64 library, and call the Base64.atob function instead

gao-sun commented 7 months ago

Can you try to import the polyfill for now?

import '@logto/rn/polyfill';