Giter VIP home page Giter VIP logo

Comments (8)

j-wil avatar j-wil commented on June 25, 2024 1

@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.

robotdan avatar robotdan commented on June 25, 2024

Can you provide an example login request and response?

from go-client.

j-wil avatar j-wil commented on June 25, 2024

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.

robotdan avatar robotdan commented on June 25, 2024

@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.

j-wil avatar j-wil commented on June 25, 2024

@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.

michaeldabbott avatar michaeldabbott commented on June 25, 2024

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.

robotdan avatar robotdan commented on June 25, 2024

@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.

robotdan avatar robotdan commented on June 25, 2024

Thanks for the update @j-wil happy to assist.

from go-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.