Issues with "Updates all authentication methods by replacing them with the given ones." #476
Open
5 tasks done
Labels
bug
This points to a verified bug in the code
Checklist
Description
There an API that supposed to update all MFA factors for a given user. Here is URL to the documentation: https://auth0.com/docs/api/management/v2#!/Users/put_authentication_methods
First of all, documentation itself is invalid. It has an example with a payload that is an object "{}", however if you send an object to the API it will respond with error:
Auth0::BadRequest ({"statusCode":400,"error":"Bad Request","message":"Payload validation error: 'Expected type array but found type object'.","errorCode":"invalid_body"})
Okay, but now if we send an array instead it will be send to the API as empty body. Moreover payload argument will be mutated. This is due how HTTProxy mixin work (
auth0/mixins/httpproxy.rb
):take a look on this line:
Since body is an Array and not a ruby Hash, all elements will be filtered from here, original array will be mutated and empty body to be send to the API. This is definitely a bug that need to be fixed.
There is a similar issue listed here, but it's a bit different: #309
I think the line should be changed to be something like:
Reproduction
Request:
Error
Auth0::BadRequest ({"statusCode":400,"error":"Bad Request","message":"Payload validation error: 'Expected type array but found type object'.","errorCode":"invalid_body"})
OR if you do the following:
it will make
auth0_payload
to became empty array, and empty body will be send to the APIAdditional context
No response
ruby-auth0 version
5.12.0
Ruby version
2.7.2+ (doesn't really matter)
The text was updated successfully, but these errors were encountered: