8000 GitHub - promise-authentication/omniauth-promise
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

promise-authentication/omniauth-promise

Repository files navigation

OmniAuth Promise

This gem provides a way for application to integrate with Promise.

Installation

Add this line to your application's Gemfile:

gem 'omniauth-promise'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install omniauth-promise

Usage

In config/initializers/promise.rb add

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :promise, 'example.com'
end

Now redirect your users to

  <%= link_to 'login', '/auth/promise' %>

And make sure you have

  get 'auth/promise/callback', to: "sessions#new"

in config/routes.rb and the corresponding controller in app/controllers/sessions_controller.rb:

class SessionsController < ApplicationController
  def new
    @user_id = auth_hash[:uid]
  end

  protected

  def auth_hash
    request.env['omniauth.auth']
  end
end

Where example.com is your client_id with Promise.

With Devise

In config/initializers/devise.rb add

...
config.omniauth :github, 'example.com'
...

Where example.com is your client_id with Promise.

How to pick a client_id?

A client_id is what Promise uses to control generation of identities. Each user, will get a unique random identity per client_id.

So, you should make the client_id the shortest possible domain you control. Eg. if you have site on www.example.com, you probably should choose example.com to be your client_id.

If you host your application on a provider, where you only control a subdomain, you should use that. Eg. blm.herokuapp.com.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/promise-authentication/omniauth-promise. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Omniauth::Promise project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0