po.studio
po.studio

Reputation: 4127

hardcoding CONSUMER_KEY and CONSUMER_SECRET

https://github.com/ryanatwork/sign-in-with-linkedin

This example rails application that lets a user log in with LinkedIn requires that the "rails server" command in the terminal be prefaced by 'CONSUMER_KEY=[consumer key] CONSUMER_SECRET=[consumer secret]' so that the whole command looks like:

CONSUMER_KEY=[consumer key] CONSUMER_SECRET=[consumer secret] rails server

The linkedin login obviously won't work with a consumer key/secret, but I'm having trouble hardcoding my consumer key/secret into the app so that I can deploy to Heroku successfully, but am not having any luck. I've tried in several different config and controller files without any luck. Help appreciated!

Upvotes: 0

Views: 403

Answers (2)

Gareth
Gareth

Reputation: 138110

When you deploy to Heroku you need to have these variables set using the heroku config command:

heroku config:add CONSUMER_KEY=[consumer key]

If you use Foreman to start your server (as Heroku does at their end) then you can have these variables loaded from a local file which never gets committed into your source control (you don't want these secret details in your source control)

Upvotes: 1

Ylan S
Ylan S

Reputation: 1786

Don't hardcode to heroku. You can use environment variables in Heroku to set CONSUMER_KEY and CONSUMER_SECRET.

Here are the docs from Heroku: https://devcenter.heroku.com/articles/config-vars

Upvotes: 1

Related Questions