This gem contains the MapMyFitness strategy for OmniAuth using OAuth2.
Add the dependency to your application's Gemfile:
gem 'omniauth-mapmyfitness-oauth2'
Your secret credentials should be stored in environment variables. You can do this in a your .bash_profile
with the following:
export MMF_API_KEY=your_key_goes_here
export MMF_API_SECRET=your_secret_goes_here
Once you have those ENV variables set, you can check them from IRB:
$ irb
> ENV['MMF_API_KEY']
=> "09375ijkds9072l"
> ENV['MMF_API_SECRET']
=> "08993mhjd8721lk"
Create a config/initializers/omniauth.rb
with the following:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :mapmyfitness, ENV['MMF_API_KEY'], ENV['MMF_API_SECRET']
end
NOTE: The ENV['MMF_API_KEY']
is unsed in an unusual place in this strategy. It must be defined for the library to work.