Authentication
Step-by-Step Authentication
Step 1: Generate Nonce
import { YieldFiSDK } from "yieldfi-sdk";
const sdk = await YieldFiSDK.create({
gatewayUrl: "https://gw.yield.fi",
});
// Generate nonce for user's address
const nonce = await sdk.auth.generateNonce({
address: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
});
console.log(nonce.message);
// "Sign this message to authenticate with YieldFi.\n\nAddress: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb\nNonce: abc123..."Step 2: Sign Message with Wallet
Step 3: Login with Signature
Step 4: Store Tokens
Complete Example
Error Handling
Security Best Practices
Next Steps
Last updated