Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

henshin-belt

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

henshin-belt

  • 0.0.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Hensin Belt on Grape API

Hensin Belt is a Grape middleware to connect your API resources with your API authenticator.

Installation

Add this line to your application's Gemfile:

gem 'henshin-belt'

And then execute:

$ bundle

Or install it yourself as:

$ gem install henshin-belt

Usage

Install generator

On your first install, run this generator :

rails g henshin_belt:install

Usage with Grape

You will need to use the middleware in your main API :

# use middleware
use ::HensinBelt::Oauth2

You could also use the helpers :

# use helpers
helpers ::HensinBelt::Helpers

Protecting your endpoint

In your endpoint you need to define which protected endpoint by adding this DSL :

  1. oauth2
  2. oauth2(:email)

Example :

desc "Your protected endpoint"
oauth2 
get :protected do
    # your code goes here
end
desc "Your protected endpoint with defined scope"
oauth2(:email)
get :protected do
    # your code goes here
end

Nice feature

From your protected endpoint you could get :

  1. resource_token => Your access token
  2. resource_credential => Full credentials
  3. resource_owner => Current Object
  4. me => Current Object

FAQs

Package last updated on 03 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc