Login Flow
There are two main steps in Login
Obtain the user token
Obtain the user token by logging with integrated social providers. This token can be a JWT token or another type of token, depending on the configuration of the social authentication provider you used. For social providers like Google and Firebase , user token is the ID Token (JWT) which must include the email as a claim. For Discord, the user token is the Discord access token.
Obtain the wallet address using Kaiju getWallet API
Get the wallet address using getWallet API.
const KAIJU_AUTH_PROVIDER_ID = "65fc4fa3d948cc6313aca1200o9i8" ;
const KAIJU_ACCESS_KEY = "vj*?pr$1_0fK$7B+p7LbCFQRKUJ=lS1q2w3" ;
const token = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjY3NGRiYmE4ZmFlZTY5YWNhZTFiYzFiZTE5MDQ1MzY3OGY0NzI4MDMiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhenAiOiIzMDAzNzIwMzQyMDItY2NidmxsdTE2Z2w4NWswMjEyZmdmaHVtcmZhb3Npa3QuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJhdWQiOiIzMDAzNzIwMzQyMDItY2NidmxsdTE2Z2w4NWswMjEyZmdmaHVtcmZhb3Npa3QuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJzdWIiOiIxMTI3MjU4MTQwMzY4MTAxNjI2MjEiLCJlbWFpbCI6ImFwcGthaWp1QGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJhdF9oYXNoIjoiUEVsOEZoeHpLVGxUZzVTeW9PckluZyIsIm5hbWUiOiJLYWlqdSBBcHAiLCJwaWN0dXJlIjoiaHR0cHM6Ly9saDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tL2EvQUNnOG9jTGVIX21PWU9rM0dOOVJqZWJYWVd1WlNXMzFOcGZjOEJUQXJJOUJmeW9HcDlQR2t4ND1zOTYtYyIsImdpdmVuX25hbWUiOiJLYWlqdSIsImZhbWlseV9uYW1lIjoiQXBwIiwiaWF0IjoxNzE3NzI5MTYwLCJleHAiOjE3MTc3MzI3NjB9.bw1IH8tlekgFteySjrbO2k4UR-byiC0PywCK6mz-rcdgnQhfQITL_8GyZNJozs1K2-ldaT0SRkhrErG8WG0CD08bltqD-O5OrUrwQYJO8Rj1u5klgUB44TuF1k8MoEUQ6AmOkiDNd8fbTwl-BDtqzSPmBCEPde6nMlqgmvFDjzKgJvF5P9vMQsiCGX9YjI66tW_pAgNqZFYsdTUKxHBpGTVam7VHoGEPhfN-mZtnd55To6kgWSx_46i4dNJU75h0zfzsPVUWfyIBYOdxAaG4yAn6LjXfxWuOqHH0ZDonT2lxmoAEioru6GlMoSK4SAkF4RgYMrUWKWLzGJQgwHFXgw" ;
const KAIJU_SAAS_WALLET_BASE_URL = "https://api.wallet.kaiju3d.com/v1"
const headers = new Headers();
headers.append ('authProviderId', KAIJU_AUTH_PROVIDER_ID);
headers.append('accessKey', KAIJU_ACCESS_KEY);
headers.append('Content-Type', 'application/json');
headers.append('token', token);
const body = JSON.stringify({
email,
developer: false,
blockchains: ['xrpl'],
});
const response = await fetch(
`${KAIJU_SAAS_WALLET_BASE_URL}/kms/getWallet`,
{
method: 'POST',
headers,
body,
},
);
const result = await response.json();
const xrplWalletAddress = response.data.blockchains.xrpl.walletAdrees;