JSON Web Tokens (JWT) help secure communication between two systems. Signing a JWT allows the receiver to trust the sender or "issuer". This process provides a stateless approach to authentication. A key, secret, and connection string are created for you when you create a new hyper cloud application.
Don't share your secret or connection string!
Hyper uses the HS algorithm. HS algorithms require sharing a secret. Remember to keep the secret and connection string in a secure place. DO NOT SHARE ON VERSION CONTROL. DO NOT STORE IN YOUR SOURCE CODE WHERE IT CAN BE EXPOSED ON THE CLIENT SUCH AS THE WEB BROWSER.
When making raw HTTP calls using a utility such as cURL, you won't have the ability to use hyper-connect. Here's how to create a JSON Web Token (JWT) using your hyper cloud application's connection string and NodeJS.
- Create a .env file. Within the .env file, create an environment variable named HYPER.
- Paste the connection string as the value of the HYPER environment variable:
- Install the following dependencies using npm or yarn:
Consuming your hyper cloud application is secured using a Bearer token, provided in an Authorization header. See JWT Auth for details on creating a bearer token using your hyper cloud application key pair.
Alternatively, Deno and NodeJS may simply use the hyper-connect module, which automatically generates a short-lived JWT for you on each request, using your hyper cloud application connection string.