Giter Club home page Giter Club logo

omniauth-siwe's Introduction

Omniauth::Siwe

OmniAuth strategy for Sign In With Ethereum (SIWE)

Installation

Add this line to your application's Gemfile:

gem 'omniauth-siwe'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install omniauth-siwe

Usage

To use either oidc.login.xyz or a self-hosted alternative, you must first register as a client using the request below as an example, filling in your application's own redirection URIs.

$ curl -X POST 'https://oidc.login.xyz/register' \
  -H 'Content-type: application/json' \
  --data '{"redirect_uris": ["http://localhost:3000/auth/siwe/callback"]}'

{"client_id":"your-identifier","client_secret":"your-secret","redirect_uris":["http://localhost:3000/auth/siwe/callback"]}%

Then you have to configure the OmniAuth provider like the example below: If you are using oidc.login.xyz, then you only need to fill in your credentials, otherwise you will need to change host, port and scheme according to the chosen host.

Rails.application.config.middleware.use OmniAuth::Builder do
  configure do |config|
    config.path_prefix = '/auth'
    config.allowed_request_methods = %i[post get]
  end

  # other providers

  issuer = 'https://oidc.login.xyz/'
  client_options = {
    scheme: 'https',
    host: 'oidc.login.xyz',
    port: 443,
    authorization_endpoint: '/authorize',
    token_endpoint: '/token',
    userinfo_endpoint: '/userinfo',
    jwks_uri: '/jwk',
    identifier: 'your-identifier',
    secret: 'your-secret'
  }

  provider :siwe, issuer: issuer, client_options: client_options
end

omniauth-siwe's People

Contributors

theosirian avatar

Stargazers

losingle avatar Dieter Lunn avatar supermomonga avatar Li Ding avatar Afri avatar

Watchers

Charles E. Lehner avatar wyc avatar Em avatar Jakub Szerszen avatar  avatar Sølst1c3 avatar Sam Gbafa avatar Gregório Granado Magalhães avatar Simon Bihel avatar  avatar  avatar Gregory Rocco avatar Juliano Cézar Chagas Tavares avatar K avatar  avatar Afri avatar

omniauth-siwe's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.