Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var isConnected = await wallet.IsConnected();

// Email & Phone (OTP)
await wallet.SendOTP(); // and fetch the otp
var (address, canRetry) = await wallet.LoginWithOtp("userEnteredOTP");
var address = await wallet.LoginWithOtp("userEnteredOTP"); // try catch and retry if needed

// Socials (OAuth)
var address = await wallet.LoginWithOauth(
Expand Down Expand Up @@ -121,12 +121,8 @@ await wallet.SendOTP();
**Submit OTP:** Once the user receives the OTP, they submit it back to the application, which then calls LoginWithOtp on the InAppWallet instance to verify the OTP and complete the login process.

```csharp
var (address, canRetry) = await wallet.LoginWithOtp("userEnteredOTP");
if (address != null) {
// Login successful
} else if (canRetry) {
// Ask user to retry entering OTP
}
var address = await wallet.LoginWithOtp("userEnteredOTP");
// If this fails, feel free to catch and take in another OTP and retry the login process
```

## Example
Expand All @@ -143,18 +139,7 @@ if (!await inAppWallet.IsConnected())
await inAppWallet.SendOTP();
Console.WriteLine("Please submit the OTP.");
var otp = Console.ReadLine();
(var inAppWalletAddress, var canRetry) = await inAppWallet.LoginWithOtp(otp);
if (inAppWalletAddress == null && canRetry)
{
Console.WriteLine("Please submit the OTP again.");
otp = Console.ReadLine();
(inAppWalletAddress, _) = await inAppWallet.LoginWithOtp(otp);
}
if (inAppWalletAddress == null)
{
Console.WriteLine("OTP login failed. Please try again.");
return;
}
var inAppWalletAddress = await inAppWallet.LoginWithOtp(otp); // try catch and retry if needed
}

Console.WriteLine($"InAppWallet address: {await inAppWallet.GetAddress()}");
Expand Down
Loading