Skip to content

diegomelo182/rails-7-jwt-auth-api

Repository files navigation

JWT Auth API Example

Here I want to share a JWT Auth Rest API with you

Below I will show the master.key file content, and yes I know that we never can share this, but as this project do not will be in production I will share it with you all guys.

config/master.key (d8e69fa08807a6b75d01af19af3b5dec)

Run the migrations and the Seed

$ rails db:create db:migrate db:seed

The seed creates a default user and password, follow the data below:

Now you can use this on [POST] /v1/auth/sign_in endpoint.

Run Rails

$ rails server

Endpoints

Auth

[POST] /v1/auth/sign_in

Payload:

{
  "login": "your-email-here",
  "password": "your-password-here"
}

Returns:

{
  "is_valid": true
}

[POST] /v1/auth/renew

Payload:

{
  "token": "your-token-here"
}

Returns:

{
  "is_valid": true
}

[POST] /v1/auth/valid

Payload

{
  "token": "your-token-here"
}

Returns:

{
  "is_valid": true
}

There is a Rails Scaffold called User that can only be accessed with a valid token on Athorization header.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published