Coder Social home page Coder Social logo

inworld-nodejs-generate-token1's Introduction

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. This service can be easily deployed by using the template of this project on Railway.app. More information can be found in the Railway.app Service Setup section.

If you require to host the project on your own dedicated platform and need 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, Secret and Scene ID after the INWORLD_KEY, INWORLD_SECRET and INWORLD_SCENE 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
INWORLD_SCENE String The Inworld Scene ID . 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

Railway.app Service Setup

The following is are the instructions for setting up the Inworld Generate Token project easily using the service Railway.app. The service requires a GitHub account and will clone this repo into the account.


  1. Goto the Inworld Token Generator template page on Railway.app and click on the Deploy Now button.

Railway.app Dashboard Homepage


  1. Fill out the INWORLD_KEY, INWORLD_SECRET and INWORLD_SCENE fields respectively and click on the Deploy button. Information on these can be found in the Environment Variables section.

Railway.app Template Deploy


  1. The service will now deploy and wait until it says Success to know when it's live. If you run into any issues click on the View Logs button and see if errors appear in them.

Railway.app Template Deploy


  1. Click on the Settings tab and scroll down to Domains. Click on the Generate Domain button

Railway.app Domain Settings


  1. A public facing domain will now be created for the service.

Railway.app Domain Settings


  1. Test the domain by opening it in your web browser. You should see a successful JSON token response.

Service Token Response


Dedicated 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.


inworld-nodejs-generate-token1's People

Contributors

realill avatar disfractal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.