Comments (8)
@robotdan My apologies for taking so long to wrap back around on this but it appears I was wrong we did have 2 tenants in Fusion thus it makes complete sense that the appID is required in the request. Thanks for taking the time to respond and work with me on this.
From my perspective, this is a non-issue but I'm not sure if the OP is satisfied or not.
from go-client.
Can you provide an example login request and response?
from go-client.
I may have run into this issue today. If you have multiple application and you make a request without an application Id I would get a "[TenantIdRequired]"
error in my response.
Code that returns a TenantIdRequired errors:
func (s Service) Login(c echo.Context, user string, pass string) (model.AuthToken, error) {
var credentials fusionauth.LoginRequest
credentials.LoginId = user
credentials.Password = pass
// credentials.ApplicationId = s.appID
r, errors, err := s.fa.Login(credentials)
if err != nil {
return model.AuthToken{}, err
}
if errors != nil {
return model.AuthToken{}, err
}
return model.AuthToken{
AccessToken: r.Token,
RefreshToken: r.RefreshToken,
TokenType: "Bearer",
}, nil
}
Simply remove the comment and add the applicationId and everything works as expected. @robotdan This may be more of an issue with FusionAuth I'm not sure but if you point me in the right direction I can report this there.
from go-client.
@j-wil this looks to be working as designed. A tenant is a namespace, so if you have more than one tenant, the email
address or username
you are providing as the user
parameter is only unique within a tenant.
Once you remove the applicationId
(which is globally unique) we no longer have enough context to look up a user by the email
address or username
.
Once you have more than one tenant, you will need to provide a tenantId
whenever the request is ambiguous.
from go-client.
@robotdan I'm new to FusionAuth so I may be confused but I currently have 1 tenant and 2 applications so when the tenantId required error came back I wasnt sure how to remedy the situation. Then according to the docs the applicaiton id is not required but recomended for most applications so I added the application id and no longer recieved the tenentID error.
I guess the confusion is I got a tenantID required error but the remedy was populating the applicationID.
from go-client.
There is a scenario where you have a multiple tenantId and the user you're logging into belongs a tenant that you're not passing in.
so for example if you have a user set up on the default tenant.
then create a tenant and try and login into that user with the new tenant being passed in
the response object is nil, the fusionauth.Errors maps to &{map[] []} and err returns EOF.
Something to look out for, usually when fusionauth.Errors results in &{map[] []} then it's likely you're passing in the wrong tenant.
Hopefully there's a scenario where fusionauth.Errors can return a an error inside fusionauth.GeneralErrors, which would potentially imply that the user you're requesting a login in for belongs to a different tenant. Or perhaps fusionauth.LoginResponse could return a 403, as it does return a statusCode.
I've opened an issue on this.
from go-client.
@j-wil If I understand correctly, you have a single tenant, and you are still seeing this error? That would be an error. Please confirm, and verify the total tenant count.
Thanks!
from go-client.
Thanks for the update @j-wil happy to assist.
from go-client.
Related Issues (20)
- compilation error: Domain.go:2031:6: JWTConfiguration redeclared in this block HOT 1
- Compilation error: Domain.go:4174:17: undefined: char HOT 4
- ResendEmailVerification(): Always getting 401 HOT 4
- Tag release according to golang standards HOT 2
- Compilation error: pkg/fusionauth/Domain.go:2858:16: undefined: double HOT 2
- Login API cant get the refresh token without Application id in body request HOT 2
- GO client does not return headers from http response HOT 1
- CreateTenant with SourceTenantId does not behave as expected HOT 2
- ChangePasswordByIdentity API not working HOT 1
- ChangePasswordByIdentity API works without current password [URGENT]
- quesiton about retrieving logs HOT 2
- Missing Create Identity-provider API HOT 1
- Invalid Content-Type when making requests against server HOT 4
- Some retrieve functions in client package swallow the errors HOT 3
- WebhookIDs not available on tenant HOT 2
- compilation error: fusionauth/Client.go:4637:81: undefined: UserinfoResponse HOT 6
- CoseAlgorithmIdentifier is typed as a string but the API returns integers
- No 2XX status codes without a body may hide errors
- RegistrationRequest.User omitempty ineffective HOT 1
- register a user to an application
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-client.