Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7832535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T12:16:08+00:00 2026-06-02T12:16:08+00:00

Each customer in our ror app is served based on subdomain and they have

  • 0

Each customer in our ror app is served based on subdomain and they have their fbappid, fbsecretid (whichi powers the customers fb app). We use omniauth, omniauth-facebook for authenticating users.
so customer1.ourapp.com serves an fb app with appid fbapp_1 and
customer2.ourapp.com server with appid fbapp_2

normal way of initialization of facebook strategy is putting the following line in a initializer

config.omniauth :facebook, APP_ID, SECRET, {:scope => 'publish_stream}

We need to set APP_ID, SECRET based on the subdomain, but it looks like request object is not avaiable at the initializer time
I looked into the dynamic setting of options using setup=> but omniauth-facebook doesnt seem to support setting of appid, appsecret dynamically.

How do we set the app_id and app_secret of omniauth-facebook dynamically based on subdomain of the request? thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T12:16:11+00:00Added an answer on June 2, 2026 at 12:16 pm

    Since you are using devise, try

    config.omniauth  :facebook, :setup => lambda{
          current_domain = // Get current domain
          config = // Get config
          env['omniauth.strategy'].options[:client_id] = config[current_domain][Rails.env]["app_id"]
          env['omniauth.strategy'].options[:client_secret] = config[current_domain][Rails.env]["app_secret"]
        }
    

    http://webcache.googleusercontent.com/search?q=cache:zmBqDAomJ84J:blog.cedricbousmanne.com/+&cd=2&hl=en&ct=clnk
    provides the solution without devise, with just omniauth

    [edited]
    Excerpt from working code

    config.omniauth :facebook, {:setup => lambda{|env|
       env['omniauth.strategy'].options[:client_id] = $institute_tenant.fbappid
       env['omniauth.strategy'].options[:client_secret] = $institute_tenant.fbappsecret
    }, :auth_type => 'https', :scope => 'email'}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In our program, each customer gets their own database. We e-mail them a link
Preface We are providing customers with our service API. Each customer has own subdomain
Our app (before authentication) has Customers and Widgets. As you'd expect each customer has
I'm working on a SaaS application where each customer will have different configurations depending
I'm working on a SaaS project that will have each customer having an instance
I have a list of Customers. Each customer has an address and some customers
I have a national customer who are currently recruiting dealers by selling each dealer
We have a cloud based SaaS application and many of our customers (school systems)
In our app, customers put in their own unique API credentials for Authorize.Net. So
I have a model for our customers and a model for their purchases/orders. In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.