Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Fix for empty auth0_client.jwt_configuration.scope #204

Merged
merged 6 commits into from
Apr 15, 2020

Conversation

alexkappa
Copy link
Owner

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Fixes #196

Changes proposed in this pull request:

  • Upgrade go-auth0/auth0 which defines Scopes as a map[string]interface{} instead of an interface{}.

The issue is demonstrated by the example below. Notice how only the first instance of S ignores V during marshal.

type S struct {
	V interface{} `json:"v,omitempty"`
}

for _, s := range []S{
	{V: nil},
	{V: (map[string]interface{})(nil)},
	{V: (*string)(nil)},
	{V: 0},
	{V: ""},
	{V: false},
} {
	b, _ := json.Marshal(s)
	fmt.Printf("%s\n", b)
}
{}
{"v":null}
{"v":null}
{"v":0}
{"v":""}
{"v":false}

See: https://play.golang.org/p/hyMWxh_FVI-

NOTE: This fixes the issue where the Auth0 API responds with a Expected type object but found type null error. There is a long standing bug of not being able to "clear" slice/map values after they have been set. Go's JSON package will ignores empty as well as nil arrays or maps when the omitempty tag is present.

@alexkappa alexkappa merged commit d8e4f46 into master Apr 15, 2020
@yvovandoorn yvovandoorn deleted the fix-client-jwt-scope branch March 24, 2021 14:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

auth0_client can not be created with missing or empty jwt_configuration.scopes object.
1 participant