Json Marshalling a ConnectionOptionsOIDC is causing failures when creating a new connection
Checklist
- [X] I have looked into the README and have not found a suitable solution or answer.
- [X] I have looked into the documentation and have not found a suitable solution or answer.
- [X] I have searched the issues and have not found a suitable solution or answer.
- [X] I have upgraded to the latest version of this SDK and the issue still persists.
- [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- [X] I agree to the terms within the Auth0 Code of Conduct.
Description
When I attempt to create an oidc connection with just a discovery url I am receiving the following error.
"options.issuer" must be a string
This was working previously I'm not exactly sure when this broke as we don't use this endpoint very often
Expectation
expected: json to marshal correctly into the following with no null values actual: json includes null values example incorrect payload with null values:
{
"name": "TestConnectionNameNew",
"display_name": "Test Connection Name New",
"strategy": "oidc",
"is_domain_connection": false,
"options": {
"client_id": "testClientId",
"client_secret": "testClientSecret",
"discovery_url": "[myDiscoveryURL](https://accounts.google.com/.well-known/openid-configuration)",
"authorization_endpoint": null,
"issuer": null,
"jwks_uri": null,
"type": "back_channel",
"userinfo_endpoint": null,
"token_endpoint": null,
"scope": "openid profile email",
}
}
If I remove the null values and hit the endpoint directly this is a valid request
Reproduction
- Run the following code to create a new connection
connection := &management.Connection{
Name: auth0.String(input.Name),
DisplayName: auth0.String(input.DisplayName),
Strategy: auth0.String(strategyOidc),
IsDomainConnection: auth0.Bool(false),
Options: &management.ConnectionOptionsOIDC{
Type: auth0.String(connectionTypeBackChannel),
ClientID: auth0.String(input.ClientId),
ClientSecret: auth0.String(input.ClientSecret),
DiscoveryURL: auth0.String(input.DiscoveryUrl),
Scope: auth0.String(connectionScopes),
},
}
err = client.management.Connection.Create(ctx, connection)
Auth0 Go SDK version
v1.8.0
I opened this PR to address the issue. Not sure if this is the actual root cause but it at least unblocks the issue I am currently seeing https://github.com/auth0/go-auth0/pull/423
Hi @alexTendo,
I hope you are having a nice day!
We are aware of this issue, and our team is actively working on resolving it. It might take some time, but we don't anticipate needing any changes on the SDK side. The new changes should be compatible with the existing setup. I will update you as soon as the team resolves the issue on the API side.
Thank you for your contribution.