# Validating access token

BlizzAPI exposes validateAccessToken static method which checks if access token is valid for a given region. It returns boolean value.

Example with promises:

const BlizzAPI = require('blizzapi');

BlizzAPI.validateAccessToken('us', 'access token')
  .then((result) => {
    if (result) {
      // do something when access token is valid
    }
  });

Example with async / await:

const BlizzAPI = require('blizzapi');

const isAccessTokenValid = await BlizzAPI.validateAccessToken('us', 'access token');

if (isAccessTokenValid) {
  // do something when access token is valid
}
Last Updated: 7/31/2019, 5:13:56 PM