Reputation: 10738
I have a Rails application that connects to Facebook using OAuth. I'm looking for is a full description of how to handle the OAuth key and secret I get from facebook.
I've seen some variants of this question, but never with a complete and detailed answer.
I'm really looking for the overall flow, but also need all the small details that may look trivial but are important to understand this.
Upvotes: 4
Views: 976
Reputation: 250
You'll want to store your secret keys and environment-specific configuration outside of your code. You should store these in a way that would allow you to publish your source code in a public repository on, say github, without ignoring any files in source control. This is a principle of the Twelve-Factor Methodology.
Anyway, to answer your question, you could add these keys as shell variables. This assumes you are developing on *nix.
$ echo "export OAUTH_SECRET='kie92j8fKEHHE92Va1njk3'" >> ~/.bash_profile
Now in your Rails code, you have access to all your environment variables:
ENV["OAUTH_SECRET"]
These environment variables can be set in a deploy script that prompts you for them on the command line. This also allows each developer on your team to have his or her own keys.
Upvotes: 5
Reputation: 2013
Most of the people create their own config.yml. It is very easy to do. Here is a detailed description for creating config.yml
Upvotes: 0