Skip to content

Commit 842097d

Browse files
committed
Merge branch 'sfa-combined' of https://github.com/Web3Auth/web3auth-docs into sfa-combined
2 parents c891196 + 49a5a7d commit 842097d

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

docs/sdk/pnp/android/usage.mdx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff 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 />

docs/sdk/pnp/flutter/usage.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff 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

437467
To logout the user and remove the session id from the device you can use the `logout` method. The

0 commit comments

Comments
 (0)