Giter Site home page Giter Site logo

omniauth-yammer's Introduction

OmniAuth Yammer

Build Status Code Climate

This gem contains the Yammer strategy for OmniAuth 1.0.

Supports the OAuth 2.0 server-side flow. Read the Yammer docs for more details: https://developer.yammer.com/authentication/#a-oauth2

Installing

Add to your Gemfile:

gem 'omniauth'
gem 'omniauth-yammer'

or even:

gem 'omniauth'
gem 'omniauth-yammer', :github => 'le0pard/omniauth-yammer'

Then bundle install.

Usage

OmniAuth::Strategies::Yammer is simply a Rack middleware. Read the OmniAuth 1.0 docs for detailed instructions: https://github.com/intridea/omniauth.

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 :yammer, ENV['YAMMER_KEY'], ENV['YAMMER_SECRET']
end

For changing default domain in gem (for dev or testing purpose) use YAMMER_DOMAIN environment variable:

ENV['YAMMER_DOMAIN'] = 'https://staging.yammer.com'

Devise

Add this line to devise config:

config.omniauth :yammer, "Consumer key", "Consumer secret"

If you have this error:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

Then you can fix this by setting valid cert:

wget http://www.cacert.org/certs/root.crt
cat root.crt >> lib/ca-bundle.crt

and edit devise config:

config.omniauth :yammer, "Consumer key", "Consumer secret", {:client_options => {:ssl => {:ca_file => "#{Rails.root}/lib/ca-bundle.crt" }}}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

omniauth-yammer's People

Contributors

ebababi avatar le0pard avatar robertingrum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

omniauth-yammer's Issues

NoMethodError (undefined method `auth_code' for #<OAuth2::Client:0x007fff399a21e0>)

Every time I try to authenticate with Yammer, I get this exception.

My Framework Trace is as follows

omniauth-oauth2 (1.1.1) lib/omniauth/strategies/oauth2.rb:48:in `request_phase'
omniauth-yammer (0.1.0) lib/omniauth/strategies/yammer.rb:37:in `request_phase'
omniauth (1.1.4) lib/omniauth/strategy.rb:214:in `request_call'
omniauth (1.1.4) lib/omniauth/strategy.rb:181:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/builder.rb:49:in `call'
rack (1.5.5) lib/rack/etag.rb:23:in `call'
rack (1.5.5) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.5) lib/rack/head.rb:11:in `call'
actionpack (4.1.13) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.1.13) lib/action_dispatch/middleware/flash.rb:254:in `call'
rack (1.5.5) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.5) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.1.13) lib/action_dispatch/middleware/cookies.rb:562:in `call'
activerecord (4.1.13) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.1.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
activerecord (4.1.13) lib/active_record/migration.rb:380:in `call'
actionpack (4.1.13) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.1.13) lib/active_support/callbacks.rb:82:in `run_callbacks'
actionpack (4.1.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.1.13) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.1.13) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.1.13) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.1.13) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.13) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.13) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.13) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.13) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.13) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.13) lib/rails/rack/logger.rb:20:in `call'
request_store (1.2.0) lib/request_store/middleware.rb:8:in `call'
actionpack (4.1.13) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.5) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.13) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
rack (1.5.5) lib/rack/lock.rb:17:in `call'
actionpack (4.1.13) lib/action_dispatch/middleware/static.rb:84:in `call'
rack (1.5.5) lib/rack/sendfile.rb:112:in `call'
railties (4.1.13) lib/rails/engine.rb:514:in `call'
railties (4.1.13) lib/rails/application.rb:144:in `call'
railties (4.1.13) lib/rails/railtie.rb:194:in `public_send'
railties (4.1.13) lib/rails/railtie.rb:194:in `method_missing'
rack (1.5.5) lib/rack/deflater.rb:25:in `call'
rack (1.5.5) lib/rack/lint.rb:49:in `_call'
rack (1.5.5) lib/rack/lint.rb:37:in `call'
rack (1.5.5) lib/rack/showexceptions.rb:24:in `call'
rack (1.5.5) lib/rack/commonlogger.rb:33:in `call'
rack (1.5.5) lib/rack/chunked.rb:43:in `call'
rack (1.5.5) lib/rack/content_length.rb:14:in `call'
unicorn (4.9.0) lib/unicorn/http_server.rb:580:in `process_client'
unicorn (4.9.0) lib/unicorn/http_server.rb:674:in `worker_loop'
unicorn (4.9.0) lib/unicorn/http_server.rb:529:in `spawn_missing_workers'
unicorn (4.9.0) lib/unicorn/http_server.rb:140:in `start'
unicorn (4.9.0) bin/unicorn:126:in `<top (required)>'
/Users/tbonderenka/.rvm/gems/ruby-2.0.0-p598/bin/unicorn:23:in `load'
/Users/tbonderenka/.rvm/gems/ruby-2.0.0-p598/bin/unicorn:23:in `<main>'

Does not support omniauth-oauth2 v1.1.0

With omniauth-oauth2:

(yammer) Callback phase initiated.
(yammer) Authentication failure! invalid_credentials: OmniAuth::Strategies::OAuth2::CallbackError, OmniAuth::Strategies::OAuth2::CallbackError

This occurs because 1.1.0 checks for a state parameters in the callback_phase which yammer does not provide.

Work around by forcing omniauth-oauth2 version 1.0.0

gem 'omniauth-oauth2', '=1.0.0'

Invalid Octal Digit

Getting "Invalid ocatal digit" error at build_access_token method eval. In callback i am getting this error. Help me to get out of this

NoMethodError on OmniAuth::Strategies::Yammer#primary_email

Probably due to an unexpected response from Yammer I got NoMethodError: undefined method '[]' for nil:NilClass at lib/omniauth/strategies/yammer.rb#L65.

Unfortunately that occurred on a production system and I don't have the exception's environment data. Nevertheless, if either raw_info['contact'] or raw_info['contact']['email_addresses'] return nil, this may happen.

Any ideas?

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.