Install, authenticate, and initialize Moov.js in your application.
After installation, you’ll generate a token server-side to communicate between Moov and your account. You’ll also set scopes to make API calls from Moov.js.
For each action you take with Moov.js, you’ll need a unique short lived access token that contains information needed to securely communicate with your Moov account.
You must generate tokens from your server-side application. Once you’ve generated a token, send it back to your client to use with Moov.js.
The examples below create an access token with a scope set to create an account. See the scopes and the Node scopes documentation for more information.
import{Moov,SCOPES}from'@moovio/node';constmoov=newMoov({accountID:"YOUR_MOOV_ACCOUNT_ID",publicKey:"PUBLIC_KEY",secretKey:"PRIVATE_KEY",domain:"YOUR_DOMAIN"});constscopes=[SCOPES.ACCOUNTS_CREATE];try{const{token}=awaitmoov.generateToken(scopes);// Do something with token
}catch(err){// Handle any errors
}