https://github.com/lewagon/omniauth-kitt
OAuth Strategy for Kitt
https://github.com/lewagon/omniauth-kitt
Last synced: 7 months ago
JSON representation
OAuth Strategy for Kitt
- Host: GitHub
- URL: https://github.com/lewagon/omniauth-kitt
- Owner: lewagon
- License: mit
- Created: 2020-03-24T15:28:25.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-13T17:43:06.000Z (about 3 years ago)
- Last Synced: 2024-10-13T11:58:22.397Z (over 1 year ago)
- Language: Ruby
- Homepage: https://rubygems.org/gems/omniauth-kitt/
- Size: 10.7 KB
- Stars: 6
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# OmniAuth::Kitt
Provides an OAuth connection for Le Wagon alumni.
## Usage with Devise
Add this line to your application's `Gemfile`, then `bundle install`:
```ruby
gem 'omniauth-kitt'
```
Go to [kitt.lewagon.com/oauth/applications](https://kitt.lewagon.com/oauth/applications) and create a new application.
Callback URL will be `http(s)://HOST/users/auth/kitt/callback`
```ruby
Devise.setup do |config|
config.omniauth :kitt, APP_ID, SECRET
# [...]
end
```
Your `User` model needs this line:
```ruby
class User < ApplicationRecord
devise :omniauthable, omniauth_providers: [ :kitt ]
# [...]
end
```
And your controller:
```ruby
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def kitt
auth = request.env["omniauth.auth"]
# [...]
end
end
```
`auth` has the following keys:
- `id` as an integer
- `github_nickname` as a string
- `email`, `first_name`, `last_name` & `avatar_url` as strings
- `admin` as a boolean
- `cities` as an array of _slugs_ (City managers)