Atlantis World Auth
Authentication module for authenticating to the game API.
Getting Started
Install the package
yarn add @atlantis-world/auth --dev
Optional but recommended, install web3modal
package
yarn add web3modal --dev
Import and use createAuthClient
import { createAuthClient } from "@atlantis-world/auth";
import Web3Modal from "web3modal";
async function example() {
const web3Modal = new Web3Modal({
network: "mainnet",
});
const provider = await web3Modal.connect();
const auth = createAuthClient(provider, {
apiBaseUrl: process.env.API_BASE_URL,
});
const authentiacteResult = await atlantisWorldAuth.authenticate();
console.log(authentiacteResult);
const currentUser = await atlantisWorldAuth.currentUser(authentiacteResult.access_token);
console.log(currentUser);
}