merigo-labs / solana-wallet-adapter

MIT License
6 stars 2 forks source link

Authorized state #2

Open kevin-nemo74 opened 1 year ago

kevin-nemo74 commented 1 year ago

Hello again @merigo-labs

as you know am working on an android application using flutter and dart and i was wondering if there is a way for the logged in user to keep a permanent authorized state in the app because when am testing the app when i close and reopen it, it loses the authorization and i have to authorize the app all over again to make transactions

bear in mind i have firebase authentication already implemented ... is there a way to make this possible or a way to work around it ?

Thanks!

merigo-labs commented 1 year ago

Hi @kevin-nemo74 !,

The library should keep the authorized state, but you'll need to call the initialize method when your app first launches (similar to Firebase if I'm not mistaken).

For example:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await SolanaWalletAdapter.initialize(); // load auth state.
  runApp(const MaterialApp(
    home: AuthorizeButton(),
  ));
}

Thanks, Merigo

kevin-nemo74 commented 1 year ago

@merigo-labs You are saving my project over and over again Thanks !!!!