Omniauth Bike Index

OmniAuth strategy for Bike Index OAuth v2
Alternatives To Omniauth Bike Index
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Devise_token_auth3,4381,516132 days ago112July 19, 2021192wtfplRuby
Token based authentication for Rails JSON APIs. Designed to work with jToker and ng-token-auth.
Omniauth Google Oauth21,3649,3524119 days ago55March 15, 20217Ruby
Oauth2 strategy for Google
Omniauth Oauth246926,7809564 months ago23June 19, 202239mitRuby
An abstract OAuth2 strategy for OmniAuth.
Hr Til339
5 years agoRuby
Today I Learned in Ruby
Weibo_2202
2215 years ago17March 02, 20154mitRuby
A ruby gem for sina weibo oauth2 api, with examples, and it actually works.
Fitgem18410335 years ago22May 27, 20159mitRuby
OAuth-based client for the fitbit.com REST API
Osso140
5 months ago35otherTypeScript
A Ruby OAuth microservice for SAML based authentication
Omniauth Vkontakte140412125 days ago30December 13, 20219mitRuby
Vkontakte OAuth2 Strategy for OmniAuth
Omniauth Weibo Oauth2138
2323 years ago15April 22, 2018mitRuby
OmniAuth Oauth2 strategy for weibo.com.
Twitter App131
12 years agoRuby
example rails 3 application that uses oauth
Alternatives To Omniauth Bike Index
Select To Compare


Alternative Project Comparisons
Readme

OmniAuth::BikeIndex Build Status

Bike Index OAuth2 Strategy for OmniAuth 1.0.

Supports the OAuth 2.0 server-side and client-side flows.

Creating an application

To be able to use OAuth on the Bike Index, you have to create an application. Go to BikeIndex.org/oauth/applications to add your application.

Once you've added your application and your routes, you'll be able to see your Application ID and Secret, which you will need for omniauth.

Note: Callback url has to be an exact match - if your url is http://localhost:3001/users/auth/bike_index/callback you must enter that exactly - http://localhost:3001/users/auth/ will not work.

Check out the Bike Index API Documentation to see what can be done with authenticated users.

Usage

First add it to you Gemfile:

gem 'omniauth-bike-index'

Here's a quick example, adding the middleware to a Rails app in config/initializers/omniauth.rb:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :bike_index, ENV['BIKEINDEX_APP_ID'], ENV['BIKEINDEX_APP_SECRET']
end

Your BIKEINDEX_APP_ID and your BIKEINDEX_APP_SECRET are both application specific. To create or view your applications go to BikeIndex.org/oauth/applications.

Edit your routes.rb file to have:

devise_for :users, controllers: { omniauth_callbacks: 'omniauth_callbacks' }

And create a file called omniauth_callbacks_controller.rb which should have this inside:

class OmniauthCallbacksController < Devise::OmniauthCallbacksController
  def bike_index
    # Delete the code inside of this method and write your own.
    # The code below is to show you where to access the data.
    raise request.env['omniauth.auth'].to_json
  end
end

Scopes

The default scope is public - which will be submitted unless you configure additional scopes. You can set scopes in the configuration with a space seperated list, e.g. for Devise

Devise.setup do |config|
  config.omniauth :bike_index, ENV['BIKEINDEX_APP_ID'], ENV['BIKEINDEX_APP_SECRET'], scope: 'read_bikes write_user read_user`
end

Available scopes: read_user, write_user, read_bikes, write_bikes

Credentials

If you don't include a scope, the response will include a uid from Bike Index for the user and nothing else.

If you include the read_bikes scope, the response will include an array of the ids the user has registered on the Index bike_ids: [3414, 29367]

You can use these IDs to access information about the bikes - e.g. api/v3/bikes/3414 & api/v3/bikes/29367

If you include the read_user scope, the response will include the user's nickname, email and name. You will also see their twitter handle and avatar if they have added them. The keys for these items - nickname, email, name, twitter & image - all accessible in the request.env['omniauth.auth'], e.g. request.env['omniauth.auth'].info.email

Auth Hash

You can also see the authetication hash (in JSON format) by going to the authentication url on the Bike Index with the user's access token - https://bikeindex.org/api/v3/me?access_token=<OAUTH_ACCESS_TOKEN>

Popular Oauth Projects
Popular Omniauth Projects
Popular Security Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Ruby
Oauth
Omniauth