File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed
Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,31 @@ val userInfo = web3Auth.getUserInfo()
358358
359359<AndroidResponse />
360360
361+ ## Session Management
362+
363+ The Session Management feature allows you to check the existing sessions with Web3Auth. The SDK will
364+ allow users to remain authenticated with Web3Auth for 1 day by default, or a maximum of 7 days, or
365+ until the user logout or session data is cleared.
366+
367+ The ` Web3AuthOptions ` initialization accepts a ` sessionTime ` parameter.
368+
369+ ### Usage
370+
371+ ``` kotlin
372+ import com.web3auth.core.Web3Auth
373+ import com.web3auth.core.types.Web3AuthOptions
374+
375+ val web3Auth = Web3Auth (
376+ Web3AuthOptions (
377+ context = this ,
378+ clientId = " YOUR_WEB3AUTH_CLIENT_ID" , // Pass over your Web3Auth Client ID from Developer Dashboard
379+ network = Network .MAINNET ,
380+ redirectUrl = Uri .parse(" {YOUR_APP_PACKAGE_NAME}://auth" ),
381+ sessionTime = 172800 // 2 Days
382+ )
383+ )
384+ ```
385+
361386## Logging out a user
362387
363388<LogOut />
Original file line number Diff line number Diff line change @@ -432,6 +432,36 @@ final userInfo = Web3AuthFlutter.getUserInfo();
432432
433433<FlutterResponse />
434434
435+ ## Session Management
436+
437+ The Session Management feature allows you to check the existing sessions with Web3Auth. The SDK will
438+ allow users to remain authenticated with Web3Auth for 1 day by default, or a maximum of 7 days, or
439+ until the user logout or session data is cleared.
440+
441+ The ` Web3AuthOptions ` initialization accepts a ` sessionTime ` parameter.
442+
443+ ### Usage
444+
445+ ``` dart
446+ late final Uri redirectUrl;
447+
448+ if (Platform.isAndroid) {
449+ redirectUrl = Uri.parse('{SCHEME}://{HOST}/auth');
450+ // w3a://com.example.w3aflutter/auth
451+ } else {
452+ redirectUrl = Uri.parse('{bundleId}://auth');
453+ // com.example.w3aflutter://auth
454+ }
455+
456+
457+ await Web3AuthFlutter.init(Web3AuthOptions(
458+ clientId: "WEB3AUTH_CLIENT_ID",
459+ network: Network.sapphire_mainnet,
460+ redirectUrl: redirectUrl,
461+ sessionTime: 172800 // 2 Days
462+ ));
463+ ```
464+
435465## Logging out a user
436466
437467To logout the user and remove the session id from the device you can use the ` logout ` method. The
You can’t perform that action at this time.
0 commit comments