Skip to content

Disfractal/inworld-nodejs-generate-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

inworld-nodejs-generate-token

This example project contains a server that uses the Inworld API Key and Secret to generate an authorization token to access Inworld.

It's important to note that this service is easily run on localhost or on a non-ssl based production server. If you use SSL or HTTPS you will need to follow the SSL/HTTPS Server Setup documentation.


Table of Contents




Requirements


Instructions


If you are setting this project up locally or on a remote server follow these instructions. If you're using an automatic hosting service like, Railway.app, you will not need to perform this but review the list of Environment Variables to know how to setup the service. If you use automated hosting services which don't allow for a .env file to be created to store your Environment Variables you will need to use the NOENV environment variable defined in the Environment Variables section.

  1. From the project directory type yarn install to download and install the project dependencies.
  2. Copy the .env-sample file to .evn.
  3. Open the .env file in an editor and enter your Inworld API Key and Secret after the INWORLD_KEY and INWORLD_SECRET fields respectively.
  4. If you wish to configure the port, set SSL keys follow the list of available environment variables here
  5. Save and close the file.
  6. If you are using this server in SSL/HTTPS mode follow the instructions here then follow the next step.
  7. Launch the application by typing in yarn start.

Environment Variables

The following are the list of Environment Variables this project supports:

Name Type Description Requirement
INWORLD_KEY String The Inworld Workspace Integration API Key. Required
INWORLD_SECRET String The Inworld Workspace Integration API Secret. Required
PORT Number The port to run the server on. Optional, defaults to 4000
USE_SSL Boolean Set to true if SSL keys are needed. Optional
SSL_KEY_NAME String The name of the SSL key file located in the keys folder. Required only if USE_SSL is true
SSL_CERT_NAME String The name of the SSL certificate file located in the keys folder. Required only if USE_SSL is true
NOENV Any Use if this service is deployed without an .env file. Optional

SSL/HTTPS Server Setup


Do to modern security requirements for browsers, if you run the Inworld Web SDK from an external or Production service that uses SSL/HTTPS you will need to setup the this project on a service that can allow HTTPS OR you need a SSL Key/Certificate.

Heroku is a known service that allows for automatic SSL/HTTPS services.

If you have your own SSL Key/Certificate you will need to setup this service the following way.

In you .env file you've setup previously, change the USE_SSL field to true. Copy your ssl key and certificate to the ./keys folder found at the root of this project. In the .env file update the SSL_KEY_NAME and SSL_CERT_NAME fields to reflect the names of those files you copied.

When you run this project using yarn start it should now be using SLL on the domain name the SSL keys were created for.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •