Skip to content

grape-oauth2/grape-oauth2-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grape & Grape::OAuth2 sample application

Build Status Code Climate License

This is an example of using Grape::OAuth2 gem with the Grape API project.

This app is ready to deploy to Heroku Deploy.

Project stack includes: Grape, Grape::OAuth2, Grape::Entity, ActiveRecord 5, Puma, PostgreSQL, Dotenv, Rack::Cors, Rubocop, RSpec.

Supported Ruby: 2.2 — 2.4

Implemented features

  • API endpoints with different types of requests (GET, POST);
  • API versioning
  • Resource Owner password credentials authentication;
  • Protected endpoints access with OAuth Tokens;
  • Generate new Access Token via Refresh Token.

Run

To run the application do the following from your command-line:

bundle exec rackup config.ru

Available API:

  GET  |  /api(.json)                     |      |  Root action   
 POST  |  /api/oauth/authorize(.json)     |      |  OAuth 2.0 Authorization Endpoint                       
 POST  |  /api/oauth/token(.json)         |      |  OAuth 2.0 Token Endpoint                               
 POST  |  /api/oauth/revoke(.json)        |      |  OAuth 2.0 Token Revocation      
  GET  |  /api/:version/me(.json)         |  v1  |  Information about current resource owner
  GET  |  /api/:version/posts(.json)      |  v1  |  Get all the posts without authorization                
  GET  |  /api/:version/posts/:id(.json)  |  v1  |  Read post by ID only if it belongs to authorized author
 POST  |  /api/:version/posts(.json)      |  v1  |  Create post from authorized user                       

Routes

To print all the API routes you can run a special Rake task:

bundle exec rake grape:routes

About

Sample application using Grape and Grape::OAuth2 gem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages