401 Response: Invalid application Id on call to Registrations API



  • I'm able to create a user and receive back the user info including the FusionAuth assigned user Id, but when trying to register that same user to an application I continue to receive a 401 Status Code:

    • Code: [Invalid]registration.applicationId.
    • Message: An application with Id [my app id] does not exist.

    Additionally, I have multi-tenants set up on FusionAuth Cloud deployment.

    Also, I am currently using FusionAuthSyncClient from the FusionAuth.Client NuGet package.

    Any help would be appreciated.

    Thank you.



  • This is actually a 400 Response.

    The fusionauth-app.log shows the following error:

    The error may exist in io/fusionauth/api/domain/UserMapper.xml

    The error may involve defaultParameterMap

    The error occurred while setting parameters

    SQL: INSERT INTO user_registrations (id, applications_id, authentication_token, clean_speak_id, data, insert_instant, last_login_instant, last_update_instant, timezone, username, username_status, users_id, verified) VALUES (?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?)

    Cause: org.postgresql.util.PSQLException: ERROR: null value in column "users_id" violates not-null constraint



  • This error happens when trying to register a user to an application that doesn't reside within the user's tenant, which leads me to my next question:

    Can you have one application that is shared across tenants?

    The FusionAuth documents covering multi-tenants gave me the impression that you could, but it seems as though you have to have an app residing within the same tenant you wish to register a user to that is also a member of that specific tenant.

    I'm looking for insight as to how multi-tenants works within FusionAuth. At this point, it looks like you have to have a copy of an application within every tenant, even though it is essentially the same application - roles, etc.

    Thank you.



  • Hi @mehamm!

    All applications are associated with one and only one tenant.

    You may find some answers to your questions around multi-tenancy here:

    https://fusionauth.io/blog/2018/09/24/multi-tenancy-in-a-single-tenant-architecture

    I will also excerpt from the article

    A FusionAuth tenant is simply a namespace where Applications, Groups, and Users exist

    Another article that might be of interest is below:
    https://fusionauth.io/blog/2020/06/30/private-labeling-with-multi-tenant

    These articles should help you understand the concept of tenants as it applies to FusionAuth.

    I hope this helps!

    Thanks,
    Josh



  • @joshua

    Everything works great when I have an application assigned in each tenant. Before proceeding to make an application per tenant, I just wanted to make certain that applications can't be shared across tenants. The good thing is that your APIs make it easy to create them.

    Thanks for your support!


Log in to reply
 

Looks like your connection to FusionAuth Forum was lost, please wait while we try to reconnect.