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

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

Closed
6 tasks done
nokios opened this issue Mar 20, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@nokios
Copy link

nokios commented Mar 20, 2024

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

@nokios nokios added the bug Something isn't working label Mar 20, 2024
@nokios
Copy link
Author

nokios commented Mar 20, 2024

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

@developerkunal
Copy link
Contributor

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!

@developerkunal
Copy link
Contributor

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.

@nokios
Copy link
Author

nokios commented May 9, 2024

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!

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