Skip to content

koshilife/omniauth-calendly

Repository files navigation

OmniAuth::Calendly

Test codecov Gem Version license

This gem contains the Calendly API v2 strategy for OmniAuth.

Before You Begin

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

To subscribe to webhooks, you need to have a paid Premium or Pro Calendly account. All other API access mirrors the access level you have in the Calendly web app.

To register your application:

  1. Go to https://calendly.com/login and log in to your Calendly account.
  2. Register as a Calendly developer by completing this form. We’ll process your request within 1 day and email you when it’s time to complete the setup.
  3. You’ll receive your Client ID and Client Secret via the password manager LastPass.
  4. See our OAuth documentation for a detailed authentication and authorization walkthrough.

Using This Strategy

First start by adding this gem to your Gemfile:

gem 'omniauth-calendly'

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

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

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
  provider :calendly, 'YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET'
end

Auth Hash Example

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

{
  "result": {
    "provider": "calendly",
    "uid": "U12345678",
    "info": {},
    "credentials": {
      "token": "ACCESS_TOKEN",
      "refresh_token": "REFRESH_TOKEN",
      "expires_at": 1596529477,
      "expires": true
    },
    "extra": {
      "raw_info": {
        "resource": {
          "avatar_url": "https://xxx.cloudfront.net/uploads/user/avatar/xxx/xxx.gif",
          "created_at": "2020-07-17T05:36:18.596606Z",
          "email": "hoge@example.com",
          "name": "USER_NAME",
          "scheduling_url": "https://calendly.com/hogehoge",
          "slug": "hogehoge",
          "timezone": "Asia/Tokyo",
          "updated_at": "2020-08-03T15:28:55.101449Z",
          "uri": "https://api.calendly.com/users/U12345678"
        }
      }
    }
  }
}

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-calendly project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.