0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
OmniAuth strategy for cybozu(Kintone and Garoon)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

OmniAuth::Cybozu

Test codecov Gem Version license

This gem contains Kintone and Garoon strategy for OmniAuth.

Before You Begin

You should have already installed OmniAuth into your app; if not, read the OmniAuth README to get started.

Now sign into the Kintone Developer Program or cybozu developer network and create an application. Take note of your API keys.

Using This Strategy

First start by adding this gem to your Gemfile:

gem 'omniauth-cybozu'

If you need to use the latest HEAD version, you can do so with:

gem 'omniauth-cybozu', :github => 'koshilife/omniauth-cybozu'

Next, tell OmniAuth about this provider. For a Rails app, your config/initializers/omniauth.rb file should look like this:

Rails.application.config.middleware.use OmniAuth::Builder do

  # For kintone.com user
  # Kintone records writable
  kintone_site = 'https://{subdomain}.kintone.com'
  kintone_scope = ['k:app_record:read', 'k:app_record:write'].join(' ')
  provider :cybozu, "CLIENT_ID", "CLIENT_SECRET", { scope: kintone_scope, client_options: { site: kintone_site }}

  # For cybozu.com user
  # Garoon schedules writable
  cybozu_site = 'https://{subdomain}.cybozu.com'
  cybozu_scope = ['g:schedule:read', 'g:schedule:write'].join(' ')
  provider :cybozu, "CLIENT_ID", "CLIENT_SECRET", { scope: cybozu_scope, client_options: { site: cybozu_site }}

end

Replace "CLIENT_ID" and "CLIENT_SECRET" with the appropriate values you obtained. Refer to the Kintone Scopes or All Scopes (include Garoon) for more details on the scope.

Auth Hash Example

The auth hash request.env['omniauth.auth'] would look like this:

{
    "provider": "cybozu",
    "uid": null, // uid will be empty, because there is no apis to get.
    "credentials": {
        "token": "ACCESS_TOKEN",
        "refresh_token": "REFRESH_TOKEN",
        "expires_at": 1581419031,
        "expires": true
    },
    "extra": {}
}

Contributing

Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant 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-cybozu project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.