Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

MFA API Bearer token issue

Abierto
#556 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@matthieupinte ya está trabajando en esto.

Desde el 12/6/2025.

  • #644 de @matthieupinte — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
ruby

Línea de trabajo

Comienza con lib/auth0/mixins/httpproxy.rb#L95 y sigue cómo se gestionan extra_headers para las solicitudes POST a través de request_with_retry. Compara esa ruta con lib/auth0/api/authentication_endpoints.rb y verifica que un MFA Bearer token pueda sobrescribir o proporcionar el encabezado de la solicitud; se considera terminado cuando la llamada a la API de MFA reportada envía el token previsto.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug
Checklist
  • I have looked into the Readme and Examples, and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.
Description

I found what it seems an issue while trying to interact with the MFA API for testing purposes, to test this API I decided to monkey patch the https://github.com/auth0/ruby-auth0/blob/master/lib/auth0/api/authentication_endpoints.rb module, this was the easiest way to interact with the MFA API using existing mechanisms (If this works and is something that makes sense including in the gem I'd love to implement a better solution and create a PR), continuing with the issue and because of how MFA endpoints work when a user does not have an authenticator method, I need to pass the mfa_token I get with the mfa_required error type in the Bearer header, this was not working and after some investigation I figured out that extra headers when making POST API calls do not work, the gem does not take extra_headers into account in that case https://github.com/auth0/ruby-auth0/blob/master/lib/auth0/mixins/httpproxy.rb#L95, I'd like to understand if that's something that makes sense implementing and if that's the case I'm available to create a PR to cover that use case.

Here just a snippet of the monkey patch I described above to associate a new MFA

module Auth0
  module Api
    module AuthenticationEndpoints
      def mfa_otp_associate(client_id: @client_id, client_secret: @client_secret, mfa_token:)
        request_params = {
          client_id: client_id,
          client_secret: client_secret,
          authenticator_types: ['otp']
        }

        request_with_retry(:post, '/mfa/associate', request_params, { 'Authorization' => "Bearer #{mfa_token}" })
      end
    end
  end
end

If the client object already has a Bearer header it will use that one and not the one I'm passing.

Please let me know if you need more information to understand my use case with the MFA API.

Reproduction

There is no easy way to reproduce this without interacting with the MFA API.

Additional context

No response

ruby-auth0 version

5.16.0

Ruby version

ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]

Lenguaje dominante
Ruby
Estrellas
205
Forks
146
Merge medio
16 h 2 min
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de auth0/ruby-auth0

Todos los issues de auth0/ruby-auth0

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.