Skip to content

cognitive-class/omniauth-cognitiveclass

Repository files navigation

omniauth-cognitiveclass

omniauth-cognitiveclass is a strategy (plugin or extension) for OmniAuth, which is a Ruby authentication library. OmniAuth integrates transparently with Devise, a popular Rails authentication solution.

Cognitive Class is also known as Big Data University. It's based on the OpenEdx platform

Usage with Devise

Add this to your Gemfile:

gem "omniauth-cognitiveclass", "~> 0.4.0"

Install the gem:

bundle install

Define these environment variables for your Ruby application:

export COGNITIVE_SITE="https://courses.cognitiveclass.ai/"
export COGNITIVE_AUTHORIZE_URL="https://courses.cognitiveclass.ai/oauth2/authorize"
export COGNITIVE_TOKEN_URL="https://courses.cognitiveclass.ai/oauth2/access_token"

export COGNITIVE_ID="..."
export COGNITIVE_SECRET="..."

export MY_ORIGIN="http://example.com:3000"

Add this to your config/initializers/devise.rb:

require "omniauth_cognitive_class"

callback_url = "#{ENV.fetch('MY_ORIGIN')}}/users/auth/bdu/callback"

config.omniauth :cognitive_class, ENV.fetch("COGNITIVE_ID"), ENV.fetch("COGNITIVE_SECRET"),
  callback_url:           callback_url,
  provider_ignores_state: true,
  strategy_class:         OmniAuth::Strategies::CognitiveClass

Follow the other steps from the Devise OmniAuth Guide.

See Also

About

CognitiveClass strategy for the Omniauth Oauth2 Ruby library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published