daSn0wie
daSn0wie

Reputation: 919

How to access the Devise Omniauth omniauth fb appid?

In my devise.rb file in the initializers folder i've set:

config.omniauth :facebook, 'APPID', 'APPSECRET',

how do I access these values in my controller? I need to write the appId out for something else but can't seem to figure out to get at these values.

Upvotes: 0

Views: 212

Answers (1)

Ashitaka
Ashitaka

Reputation: 19203

I find it weird that you'd want to do that since you want to keep your id and secret safe...

But one way, is creating a new file, let's call it constants.rb and put in your initializers folder. Like this:

APPID = "string"
APPSECRET = "string"

And then you can use those strings in your devise file like this:

config.omniauth :facebook, APPID, APPSECRET

You can use these constants in the same way in your controllers. Also, don't forget to restart your app.

Upvotes: 1

Related Questions