FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    401 Response: Invalid application Id on call to Registrations API

    Scheduled Pinned Locked Moved
    Q&A
    registrations
    0
    6
    4.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mehamm
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • M
        mehamm
        last edited by mehamm

        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

        1 Reply Last reply Reply Quote 0
        • M
          mehamm
          last edited by mehamm

          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.

          1 Reply Last reply Reply Quote 0
          • joshuaJ
            joshua
            last edited by

            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

            1 Reply Last reply Reply Quote 1
            • M
              mehamm
              last edited by

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

              1 Reply Last reply Reply Quote 0
              • joshuaJ
                joshua
                last edited by

                Referencing/linking below for future guidance for folks who view this post:

                https://fusionauth.io/community/forum/topic/900/authentication-for-an-application-with-web-client-and-mobile-front-ends

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post