FusionAuth / go-client

FusionAuth Go Client Library!
https://fusionauth.io/
Apache License 2.0
29 stars 32 forks source link

contextually bound errors regarding tenants #40

Closed michaeldabbott closed 4 years ago

michaeldabbott commented 4 years ago

Hi Y'all

So encountered an issue where if you have

Default tenant Specific tenant

a user created on the default tenant

and you make a request to a specific tenant and not the default aka pass in the wrong tenant id

fusionauth.Errors will return a &map[] []{} and err with be an EOF will no helpful error regarding the issue. A more appropriate response could be to return a 403 as part of the fusionauth.LoginResponse which contains a statusCode.

Much appreciated.

robotdan commented 4 years ago

What is the status code on this response?

michaeldabbott commented 4 years ago

The response object is nil, when this occurs so it's not set. So fusion.LoginResponse is nil, fusionauth.errors is &{map[] []} and the err object is EOF.

So I'm thinking possibly that you return a pointer to the fusionauth.LoginResponse to which the statusCode could be a 403.

robotdan commented 4 years ago

Can you make this same request using a REST client such as Postman, Insomnia or cURL and post the response code and response body here? This will tell us is there is something wrong with the API or the go client.

michaeldabbott commented 4 years ago

It's my bad. It was the way I was un-marshalling data resulting in the response object being nil.

The statusCode was actually 404 in the above scenario. Apologies.

robotdan commented 4 years ago

No problem, glad you got it worked out!