webexteams-guestissuer
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Webex Teams Guest Issuer Programmatic AuthToken Generator

This is a module that issues Webex Teams Authorization Tokens for Guest Issuer App Users that allow Guests to persistently use Webex Teams throught the Teams SDKs and Widgets within your application logic. If you want to generate tokens from the CLI refer to Steve Sfartz repository here. To use the Guest Issuer Service you must first have a Webex Teams Paid account and create a Guest Issuer Application from the Webex for Developers portal.

Installation

npm install -s webexteams-guestissuer

Usage

const { TeamsGuestIssuer } = require('webexteams-guestissuer');
const guestIssuer = TeamsGuestIssuer({
  appId: 'GuestAppId generated from the DEV Portal',
  appSeceret: 'GuestSecret generated from the DEV Portal'
});
// Generates a Unique ID for the User
const guestId = guestIssuer.generateId();
guestIssuer.generateJwt({
  userid: guestId,
  user: 'MyGuestUser'
}).then(({ token }) => {
  // guestIssuer.jwtToken = the Generated JWT for use to obtain AuthToken
  guestIssuer.retrieveAuthToken(token)
    .then(authData => {
      /**
       * { token: string, expiresIn: number in ms, expiration: formatted date }
       */
      // Uses the people/me Webex Teams Endpoint
      guestIssuer.getGuestDetails(authData.token).then(loggedInUser => {
        //{ id, emails, displayName, orgId, type: "appuser", created, avatar }
      })
    })
}).catch(error => 'Something Went Wrong');

Contributing and/or Fork

This module is written using Typescript. Clone this Module to submit PRs or continue development as your own repository.

npm install
# To Build for PROD
npm run build
# Development (watches all ts files in the src directory and builds on change
npm run dev

License

MIT

Dependencies (5)

Dev Dependencies (5)

Package Sidebar

Install

npm i webexteams-guestissuer

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

7.38 kB

Total Files

6

Last publish

Collaborators

  • samwomack