OmniAuth DoorDash OAuth2
An OmniAuth strategy for authenticating with DoorDash using JWT-based authentication.
Note: DoorDash does NOT use standard OAuth2 flows. Instead, each API request is signed with a JWT using HMAC-SHA256. This gem implements OmniAuth::Strategy directly (not OmniAuth::Strategies::OAuth2).
Installation
Add this line to your application's Gemfile:
gem 'omniauth-doordash-oauth2'And then execute:
bundle installOr install it yourself as:
gem install omniauth-doordash-oauth2Usage
Rails with Devise
In your config/initializers/devise.rb:
config.omniauth :doordash_oauth2,
developer_id: ENV["DOORDASH_DEVELOPER_ID"],
key_id: ENV["DOORDASH_KEY_ID"],
signing_secret: ENV["DOORDASH_SIGNING_SECRET"]Standalone OmniAuth
In your Rack middleware configuration:
use OmniAuth::Builder do
provider :doordash_oauth2,
developer_id: ENV["DOORDASH_DEVELOPER_ID"],
key_id: ENV["DOORDASH_KEY_ID"],
signing_secret: ENV["DOORDASH_SIGNING_SECRET"]
endAuth Hash Schema
The auth hash returned by this strategy has the following structure:
{
provider: "doordash_oauth2",
uid: "external_business_id", # Falls back to developer_id if API unavailable
info: {
name: "Store Name",
business_name: "Store Name",
email: nil # DoorDash does not provide merchant email
},
extra: {
raw_info: {
"store_id" => "external_business_id",
"store_name" => "Store Name",
"id" => "external_business_id"
}
}
}JWT Authentication Details
DoorDash uses JWT-based authentication instead of OAuth2. Each API request includes a signed JWT in the Authorization header.
JWT Header
{
"alg": "HS256",
"dd-ver": "DD-JWT-V1"
}JWT Payload
{
"aud": "doordash",
"iss": "<developer_id>",
"kid": "<key_id>",
"exp": "<now + 300>",
"iat": "<now>"
}The signing secret is base64url-encoded. The gem automatically decodes it (adding padding if needed) before signing.
Configuration Options
| Option | Required | Default | Description |
|---|---|---|---|
developer_id |
Yes | nil |
Your DoorDash developer ID |
key_id |
Yes | nil |
Your DoorDash key ID |
signing_secret |
Yes | nil |
Your DoorDash signing secret (base64url-encoded) |
api_base_url |
No | https://openapi.doordash.com |
DoorDash API base URL |
Development
After checking out the repo, run bundle install to install dependencies.
# Run tests
bundle exec rspec
# Run linter
bundle exec rubocop
# Run both (default rake task)
bundle exec rakeContributing
Bug reports and pull requests are welcome on GitHub at https://github.com/dan1d/omniauth-doordash-oauth2.
License
The gem is available as open source under the terms of the MIT License.