Skip to content

Advanced Concepts

Quick access to key concepts and features in Tokenly.

Security Features

Token Management

ts
const tokenly = new Tokenly({
  accessTokenExpiry: '15m',
  refreshTokenExpiry: '7d',
  securityConfig: {
    rotateRefreshToken: true,
    refreshTokenRotationInterval: '24h'
  }
})

Error Handling

ts
try {
  const verified = await tokenly.verifyAccessToken(token)
} catch (error) {
  if (error instanceof TokenlyError) {
    switch (error.code) {
      case 'TOKEN_EXPIRED':
      case 'TOKEN_INVALID':
      case 'FINGERPRINT_MISMATCH':
        // Handle specific errors
        break
    }
  }
}

Quick References

Released under the MIT License.