Skip to content

JWT(JSON Web Tokens) Certification Authorization Server

Notifications You must be signed in to change notification settings

webcyou-org/jwt-server

Repository files navigation

JWT(JSON Web Tokens) Authorization - Server

What are JSON Web Tokens?

JWT

Setup

$ git clone [email protected]:webcyou-org/jwt-server.git

Server Framework List

and more...

Select Server Framework

  • Ruby on Rails 5
$ bundle install --path vendor/bundle
$ bin/rails db:create db:migrate
$ bin/rails db:seed
$ bundle exec rails s

Listening on tcp://localhost:3000

Use Gem

API EndPoints

Host

http://localhost:3000

EndPoints

url method details
/api/v1/user_token POST Create Access Token (User Login)
/api/v1/users POST Create new account
/api/v1/users DELETE User Logout
/api/v1/users GET Login User Show

Default User

name email password
daisuke.takayama [email protected] test123

CURL Test

Create Access Token (User Login)

$ curl -X "POST" "http://localhost:3000/api/v1/user_token" -H "Content-Type: application/json" -d $'{"auth": {"email": "[email protected]", "password": "test123"}}'

response

{"jwt":"eyJ0eXAiOiJKV1QiLCJhbG...."}

Login User Show

$ curl -X "GET" "http://localhost:3000/api/v1/users" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG...." -H "Content-Type: application/json"

response

{"status":200,"user":{"id":1,"name":"daisuke.takayama","email":"[email protected]"}}

Open Browser

http://localhost:3000

and more...

development

SubModule

We store the front end source in the front end directory.

$ git submodule init
$ git submodule update

git clone & SubModule init

$ git clone --recursive [email protected]:webcyou-org/jwt-server.git

Author

Daisuke Takayama

License

Copyright (c) 2019 Daisuke Takayama Released under the MIT license