Passing organisation id using OmniAuth ruby implementation

Ready to post? :mag: First, try searching for your answer.
Hi, I am configuring Auth0 to work with a rails application using the SDK and the quick start guide here. I am trying to pass an organisation id so that I can load an organisation-specific login page using the code below:

  def index
    auth0_login_url = "/auth/auth0?organization=my_org_id"
    render inline: <<-HTML
      <%= button_to '#{auth0_login_url}', method: :post, data: { turbo: false } do %>
        Login
      <% end %>
    HTML
  end

When I click the login page I get the following error:

OmniAuth::Strategies::OAuth2::CallbackError

invalid_request | parameter organization is not allowed for this client

What is the correct way of passing the organization id?

Hi @ammo

Welcome to the Auth0 Community!

I am sorry about the late reply to your inquiry!

Inside the application that you are trying to pass the organization parameter to, do you have Organizations enabled? If yes, do you have them set to Business Users or to Both? Regardless of which one it is, it should be able to take in the parameter. Also, make sure you are not trying to pass the organization parameter to an M2M application.

Otherwise, if your applications has Organizations configured, you should be able to pass the org_id as you do above. As an example, if you want to have the user directly log into an organization, you would pass the org_id inside the /authorize call as below:

https://{{AUTH0_DOMAIN}}/authorize?response_type=code&client_id={{CLIENT_ID}}
&organization={{ORG_ID}}&redirect_uri={{REDIRECT_URI}}

If you have any other questions, feel free to leave a reply or post again on the community!

Kind Regards,
Nik

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.