Skip to content

Tavern-Keeper-2308/micro_auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks

Micro Auth

This application is a micro service for user authentication and management. It utilizes Devise as this is an industry standard and has robust community support for project longevity.

Table of Contents

  1. About The Project
  2. Getting Started
  3. Endpoints
  4. Contributors

About The Project

Tavern Keeper

Built With

Development

  • Ruby on Rails
  • PostgreSQL

Additional Tools and Deployment

  • Postman
  • Render

(back to top)

Gems

Production

  • rack-cors
  • devise
  • devise-api

Testing and Development

  • rspec-rails
  • simplecov
  • factory_bot_rails
  • faker
  • shoulda-matchers
  • pry
  • debug

(back to top)

Getting Started

To get a local copy up and running follow these simple example steps.

Installation

  1. Clone the repo
    git clone [email protected]:Tavern-Keeper-2308/micro_auth.git
  2. Gem Bundle
     bundle
  3. Rake
     rails db:{drop,create,migrate,seed}
  4. To run on local server, http://localhost:4000/
     rails s
  5. Live deploy via desired method

(back to top)

Testing

  1. Run test suite
    bundle exec rspec

(back to top)

Endpoints

  • Signs a user up for MicroAuth, must provide a valid email and password greater than 5 characters.
Body
{
    "email": "[email protected]",
    "password": "123456"
}
Response
{
  "token": "Y9XDYyF1CTTssa9GE14Uu5JTpvYzzk9Uajr98y6czjANemsCcxvi2oVDfrny",
  "refresh_token": "LFYxfHNU5VB1pgizMTPeJ4yndwyyNigFE1WCtukmoB_L5wgoH1cz9JmQ5Kj5",
  "expires_in": 3600,
  "token_type": "Bearer",
  "resource_owner": {
      "id": 1,
      "email": "[email protected]",
      "created_at": "2024-02-28T20:46:37.866Z",
      "updated_at": "2024-02-28T20:46:37.866Z"
    }
}

(back to top)

  • Signs a user in to MicroAuth, generating a token and a refresh token. Must provide an email and password for a signed up user.
Body
{
    "email": "[email protected]",
    "password": "123456"
}
Response
{
  "token": "We3HAeRHpwvrBPJgY2f8FrejiirtaYpAyZrboVgy9sn1PKieBRt_z6xz-bhb",
  "refresh_token": "yxPPyb6-qA4odLHgUF4rxT1xrSoEuJ91sWSosv_UzaKWgfp8Ch7ze96cxAHk",
  "expires_in": 3600,
  "token_type": "Bearer",
  "resource_owner": {
      "id": 1,
      "email": "[email protected]",
      "created_at": "2024-02-28T20:46:37.866Z",
      "updated_at": "2024-02-28T20:46:37.866Z"
    }
}

(back to top)

  • Generates a new token for a user. Must provide refresh token as bearer token, without a body.
  • Used for keeping a user logged in securely without having to provide login credentials when a token expires.
Response
{
    "token": "Jf6YUxLzxnm4_gv2zcwyWV8vpwAcxSfTuSFQJsLywTxf_JZ7LHci_vxVKZCC",
    "refresh_token": "kqJByMxiiMrnzSiXDsmK4GsSK2zGcdzdQmGSRSXbDoudmwzWUL5HbqWtwzLC",
    "expires_in": 3600,
    "token_type": "Bearer",
    "resource_owner": {
        "id": 1,
        "email": "[email protected]",
        "created_at": "2024-02-28T20:46:37.866Z",
        "updated_at": "2024-02-28T20:46:37.866Z"
    }
}

(back to top)

  • Revokes an active user's token and refresh token. Must provide either token or refresh token as a bearer token. Used for logging a user out.
  • Successful requests will not return a response.

(back to top)

  • Returns info for a user. Must provide token as bearer token, without a body.
Response
{
  "id": 1,
  "email": "[email protected]",
  "created_at": "2024-02-28T20:46:37.866Z",
  "updated_at": "2024-02-28T20:46:37.866Z"
}

(back to top)

Contact

Organization: Tavern Keeper

Organization Link: https://github.com/Tavern-Keeper-2308

Project Link: https://github.com/Tavern-Keeper-2308/micro_auth

(back to top)

Contributors

Xander Hendry

LinkedIn GitHub

Kevin Zolman

LinkedIn GitHub

About

User Authorization micro service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages