auth0/go-auth0

Connections with Wordpress strategy cannot be successfully unmarshaled due to improper expectations

Closed this issue · 4 comments

Checklist

  • I have looked into the README and have not found a suitable solution or answer.
  • I have looked into the 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 upgraded to the latest version of this SDK and the issue still persists.
  • 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

While trying to leverage the Auth0 Terraform provider to configure connections on an application, I came across a JSON decoding issue when trying to use the data source auth0_connection with the name property specified, and not the ID.

The problem is that we have a wordpress connection which the API returns with the following payload: (modified for security)

{
  "total": 1,
  "start": 0,
  "limit": 50,
  "connections": [
    {
      "id": "REDACTED",
      "options": {
        "scope": [
          "profile"
        ],
        "profile": true,
        "client_id": "REDACTED",
        "client_secret": "REDACTED"
      },
      "strategy": "wordpress",
      "name": "wordpress",
      "is_domain_connection": false,
      "realms": [
        "wordpress"
      ],
      "enabled_clients": []
    }
  ]
}

This does not line up with the expectation that Wordpress "options" should follow ConnectionOptionsOAuth2 (see management/connection.go:181 ).

This is causing the following error in the upstream terraform provider, which is as follows:

Error: failed to unmarshal response payload: json: cannot unmarshal array into Go struct field ConnectionList.connections of type string

I would provide a fix but I'm not sure what the proper options definition is.

Expectation

Getting a list of connections from the API, which contains at least one connection with the wordpress strategy, and a scope specified as an array, should properly parse.

Reproduction

  1. Given an Auth0 account with a Social connection of type Wordpress is specified
  2. Attempt to invoke management.Connection.List
  3. you will get an umarshal error.

Auth0 Go SDK version

1.4.1

If I switch ConnectionStrategyWordpress to use ConnectionOptionsGoogleOAuth2, the test I put in passes.

Hi @nokios ,

I wanted to let you know that we've successfully addressed the issue you raised. However, the fix hasn't been released just yet. I'm pleased to inform you that your PR has been merged #398 , and I want to express my gratitude for bringing it to our attention. Your contribution is greatly appreciated!

Hi @nokios ,

Great news! The issue has been fixed in version 1.6.0. Please take a moment to review, and feel free to reach out if you encounter any further issues.

Thank you for letting me know! We got around this issue ourselves by removing the un-used wordpress connection. But I am glad to know it has been addressed!