No release in over 3 years
Low commit activity in last 3 years
OAuth2 strategy for OmniAuth that authenticates users with Dropbox and exposes account metadata.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 0.3.6
>= 1.8, < 2.0
 Project Readme

OmniAuth Dropbox Strategy

Test Gem Version

omniauth-dropbox2 provides a Dropbox OAuth2 strategy for OmniAuth.

Installation

Add this line to your application's Gemfile:

gem 'omniauth-dropbox2'

Then run:

bundle install

Usage

Configure OmniAuth in your Rack/Rails app:

use OmniAuth::Builder do
  provider :dropbox, ENV.fetch('DROPBOX_APP_KEY'), ENV.fetch('DROPBOX_APP_SECRET')
end

Provider App Setup

Options

  • Request-phase query options can be passed directly to /auth/dropbox when supported by Dropbox OAuth endpoints.

Auth Hash

Example payload from request.env['omniauth.auth'] (real flow shape, anonymized):

{
  "uid": "dbid:sample-account-id",
  "info": {
    "name": "Sample User"
  },
  "credentials": {
    "token": "sample-access-token",
    "refresh_token": "sample-refresh-token",
    "expires": false,
    "scope": "files.metadata.read"
  },
  "extra": {
    "raw_info": {
      "account_id": "dbid:sample-account-id",
      "name": {
        "given_name": "Sample",
        "surname": "User",
        "familiar_name": "Sample",
        "display_name": "Sample User",
        "abbreviated_name": "SU"
      },
      "email": "sample@example.test",
      "email_verified": true,
      "disabled": false,
      "country": "IT",
      "locale": "en",
      "referral_link": "https://www.dropbox.com/referrals/AABsample",
      "is_paired": false,
      "account_type": {
        ".tag": "basic"
      },
      "root_info": {
        ".tag": "user",
        "root_namespace_id": "123456",
        "home_namespace_id": "123456"
      }
    }
  }
}

Notes:

  • uid is mapped from raw_info.account_id
  • info.name is mapped from raw_info.name.display_name
  • credentials includes token, plus refresh_token when provided by Dropbox
  • extra.raw_info is the full users/get_current_account response

Development

bundle install
bundle exec rake

The default Rake task runs:

  • standardrb
  • rake test_unit (strategy/unit Minitest suite)

Run Rails integration tests with an explicit Rails version:

RAILS_VERSION='~> 8.1.0' bundle install
RAILS_VERSION='~> 8.1.0' bundle exec rake test_rails_integration

Test Structure

  • test/omniauth_dropbox2_test.rb: strategy/unit behavior
  • test/rails_integration_test.rb: full Rack/Rails request+callback flow
  • test/test_helper.rb: shared test bootstrap

Compatibility

  • Ruby: >= 3.2 (tested on 3.2, 3.3, 3.4, 4.0)
  • omniauth-oauth2: >= 1.8, < 2.0
  • Rails integration lanes: ~> 7.1.0, ~> 7.2.0, ~> 8.0.0, ~> 8.1.0

Release

Tag releases as vX.Y.Z; GitHub Actions publishes the gem to RubyGems.

License

MIT