diff --git a/.changeset/cold-dryers-dream.md b/.changeset/cold-dryers-dream.md new file mode 100644 index 00000000000..dc8fb5ce30f --- /dev/null +++ b/.changeset/cold-dryers-dream.md @@ -0,0 +1,58 @@ +--- +"@thirdweb-dev/react-native": patch +--- + +Custom JWT support in React Native + +Enables passing a custom JWT to the embeddedWallet: + +```javascript +import { + EmbeddedWallet, + embeddedWallet, + ThirdwebProvider, + useCreateWalletInstance, + useSetConnectedWallet, +} from '@thirdweb-dev/react-native'; +import {Button} from 'react-native'; +import React from 'react'; + +const App = () => { + return ( + + + + ); +}; + +const AppInner = () => { + const createInstance = useCreateWalletInstance(); + const setConnectedWallet = useSetConnectedWallet(); + + const triggerConnect = async () => { + const embeddedWalletConfig = embeddedWallet(); + + if (embeddedWalletConfig) { + const instance = createInstance(embeddedWalletConfig); + + if (instance) { + await (instance as EmbeddedWallet).connect({ + loginType: 'custom_jwt_auth', + encryptionKey: 'hello', + jwtToken: 'customJwt' || '', + }); + setConnectedWallet(instance); // this sets the active wallet on the provider enabling all thirdweb hooks + } + } + }; + + return