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.
1
2
3
4
curl -X POST "https://api.moov.io/oauth2/token"\
-u "PUBLIC_KEY:PRIVATE_KEY"\
--data-urlencode "grant_type=client_credentials"\
--data-urlencode "scope=/accounts.write"\
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
}