Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Received wrong number of arguments. [nil] #43

Open
74PythonPete opened this issue Dec 21, 2024 · 1 comment
Open

Received wrong number of arguments. [nil] #43

74PythonPete opened this issue Dec 21, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@74PythonPete
Copy link

hi there ive tried to follow this as best i can:

But i keep getting the same error 'Received wrong number of arguments. '
ive enclosed some files which might help
i really need to get this to work (job may depend on it)

I either get Received wrong number of arguments. [nil] or Received wrong number of arguments. [nil]

cant put any files on here I've added the trace:
I can sent you anything you need to see

omniauth.txt

trace.txt

@74PythonPete 74PythonPete added the bug Something isn't working label Dec 21, 2024
@pond pond self-assigned this Dec 21, 2024
@pond
Copy link
Member

pond commented Dec 23, 2024

RIPA couldn't survive the dire economic conditions caused by our current administration's ill-advised austerity-based approach to financial "management" and closed down a few weeks ago. I don't know if I'll be able to keep maintaining this software in my free time; I'd certainly have to fork it to my own repo and publish from there.

I can only offer bare minimum support. Not having a job into Christmas / NY is very difficult.

hi there ive tried to follow this as best i can:

Follow what as best you can?

omniauth.txt

This isn't directly helpful, as you've not said where the "received wrong number of arguments" error is coming from - bug reports are better with the exception backtrace included, for future reference. However, README.md says this:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider(
    :entra_id,
    {
      client_id:     ENV['ENTRA_CLIENT_ID'],
      client_secret: ENV['ENTRA_CLIENT_SECRET']
    }
  )
end

...but you seem to have written this instead:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :entra_id, ENV['AAD_CLIENT_ID'], ENV['AAD_CLIENT_SECRET'], {
    tenant_id: ENV['AAD_TENANT_ID'],
    scope: 'openid profile email' # Adjust scopes as needed
  }
end
  • Even though parens in Ruby method calls are optional, I very strongly encourage their use at all times for clarity. You'll find your own provider call easier to read.
  • You are passing three parameters to this call, then a Hash. Clearly, the example in the read-me shows one parameter then a Hash. Your client ID and secret are incorrectly specified.

I also note you haven't renamed your env vars for AAD -> Entra but I assume that's correct and they're still defined in your environment under the old names. In that case, I think you want to write something like this (untested guesswork code):

Rails.application.config.middleware.use OmniAuth::Builder do
  Rails.logger.debug "Initializing OmniAuth with Client ID: #{ENV['AAD_CLIENT_ID']}, Client Secret: #{ENV['AAD_CLIENT_SECRET']}, Tenant ID: #{ENV['AAD_TENANT_ID']}"

  provider(
    :entra_id,
    {
      client_id:     ENV['AAD_CLIENT_ID'],
      client_secret: ENV['AAD_CLIENT_SECRET'],
      tenant_id:     ENV['AAD_TENANT_ID'],
      scope:         'openid profile email'
    }
  )
end

If this doesn't work then, as I say, please post the backtrace. I'm unlikely to respond until some time in New Year now though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants