Skip to content

IneffableInventions/meteor-react-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to use jsonwebtoken with a Meteor app?

This is a simple example of how to use json web tokens with a Meteor and React JS.

Required technologies

Steps

  1. Create a new Meteor app with the command "meteor create {your-app-name}".

  2. Add the following dependencies to your project:

  • react
  • react-dom
  • react-router-dom
  1. Create forms for log in and sign up. Using the Meteor structure, they should be inside "public/ui/". We recommend you to create 4 components:
  • Login
  • SignUp
  • Home
  • Navbar
  1. Add the following dependencies:
  • cryptr
  • jsonwebtoken
  1. Create a folder inside "public" named "api" and add a file named "users.js".
  • Complete info
  1. Generate two differents SHA256 using this web generator https://passwordsgenerator.net/sha256-hash-generator/ or any other method from your preference. Use different and complex words for making this. Assign the result two to different enviroment variables:

SET CODE_CRYPTR={YOUR_SECRET_1} SET CODE_TOKEN={YOUR_SECRET_2}

Remember not to share this values with anybody.

You can run your meteor app using this command:

SET CODE_CRYPTR={YOUR_SECRET_1} && SET CODE_TOKEN={YOUR_SECRET_2} && meteor

About

A simple example of how to use json web tokens with Meteor and React JS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published