OmniAuth Uber Eats OAuth2
An OmniAuth strategy for authenticating with Uber Eats using OAuth 2.0.
Installation
Add this line to your application's Gemfile:
gem 'omniauth-uber-eats-oauth2'And then execute:
bundle installOr install it yourself as:
gem install omniauth-uber-eats-oauth2Usage
Rails / Devise
In your Devise initializer (config/initializers/devise.rb):
config.omniauth :uber_eats_oauth2,
ENV['UBER_EATS_CLIENT_ID'],
ENV['UBER_EATS_CLIENT_SECRET']Standalone (Rack)
use OmniAuth::Builder do
provider :uber_eats_oauth2,
ENV['UBER_EATS_CLIENT_ID'],
ENV['UBER_EATS_CLIENT_SECRET']
endAuth Hash Schema
After successful authentication, request.env['omniauth.auth'] will contain:
{
provider: 'uber_eats_oauth2',
uid: 'abc123', # store_id from Uber Eats
info: {
name: 'Pizza Palace', # store name
business_name: 'Pizza Palace',
email: nil # Uber Eats does not expose merchant email
},
credentials: {
token: 'ACCESS_TOKEN',
refresh_token: 'REFRESH_TOKEN',
expires_at: 1234567890,
expires: true
},
extra: {
raw_info: {
store_id: 'abc123',
store_name: 'Pizza Palace',
id: 'abc123',
status: 'ACTIVE'
}
}
}Configuration Options
| Option | Default | Description |
|---|---|---|
sandbox |
false |
Reserved for future sandbox environment support |
Callback URL
Uber Eats requires an exact redirect URI match. The strategy automatically strips query parameters from the callback URL before token exchange.
Register your callback URL in the Uber Developer Dashboard:
https://yourdomain.com/auth/uber_eats_oauth2/callback
Token Refresh
Uber Eats access tokens are valid for 30 days (2,592,000 seconds). To refresh:
client = OAuth2::Client.new(
ENV['UBER_EATS_CLIENT_ID'],
ENV['UBER_EATS_CLIENT_SECRET'],
site: 'https://api.uber.com',
token_url: 'https://auth.uber.com/oauth/v2/token'
)
token = OAuth2::AccessToken.from_hash(client, {
access_token: stored_token,
refresh_token: stored_refresh_token
})
new_token = token.refresh!Scopes
The default scope is eats.pos_provisioning (authorization_code flow for merchant connection). Other available scopes:
-
eats.store- Store data access -
eats.order- Order data access -
eats.report- Report data access
Development
git clone https://github.com/dan1d/omniauth-uber-eats-oauth2.git
cd omniauth-uber-eats-oauth2
bundle install
bundle exec rspec # Run tests (100% line + branch coverage required)
bundle exec rubocop # Run linter (0 offenses required)
bundle exec rake # Run bothLicense
The gem is available as open source under the terms of the MIT License.