Skip to content

wdi-sg/express-api-key-authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express API Key Authentication Example

This example shows a simple way to secure an API, you a single API Key, which must be given in all requests. This API Key can be stored in the server's environment variables and compared against a second token passed in the request http header.

In this example, the AJAX code retrieves the token from local storage. In the same way, if you wanted an easy way to add Admin access to your API, you could manually add this token to the local storage on your browser, then only you would be able to access the Admin features of the API.

You can use something like: http://randomkeygen.com/ to generate a random key.

About

A simple example of authentication for an express app with only 1 user.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published