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

    Connector service docs say it needs only user.id, but fails it not given email too

    Scheduled Pinned Locked Moved Unsolved
    Q&A
    connectors ritza
    2
    3
    2.2k
    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.
    • F
      fusionauth.qhj5e
      last edited by

      I think this might be a bug.

      I made a web service for a Connector that returned:

      return response.status(200).json({
          user: {
              'id': '647978c5-01a0-49b8-8f4f-daab25e7ce63',
              'password': 'password',
              'active': true
          }
      });
      

      FusionAuth System Event Log said I hadn't given it a unique id, which is not true:

      Generic Connector Debug Log for [Test] with Id [b9a215ed-3078-4339-9638-62416fd20837].
      
      3/20/2024 01:58:58 PM Z Attempting authentication request to application with Id [e9fdb985-9173-4e01-9d73-ac2d60d1dc8e] from IP address [172.27.0.1] for [myemailaddress+frontegguserc@simplelogin.com] against the URL [http://host.docker.internal:6252].
      3/20/2024 01:59:00 PM Z Endpoint returned status code [200].
      3/20/2024 01:59:00 PM Z Connector User:
      {
        "active" : true,
        "connectorId" : "e3306678-a53a-4964-9040-1c96f36dda72",
        "data" : {
          "hi" : "hi!"
        },
        "id" : "647978c5-01a0-49b8-8f4f-daab25e7ce63",
        "memberships" : [ ],
        "passwordChangeRequired" : false,
        "preferredLanguages" : [ ],
        "registrations" : [ ],
        "twoFactor" : {
          "methods" : [ ],
          "recoveryCodes" : [ ]
        },
        "usernameStatus" : "ACTIVE",
        "verified" : false
      }
      3/20/2024 01:59:00 PM Z 
      . WARNING DISCARDING USER Connector because it was missing a unique id in the [user.id] or enough information to store in FusionAuth (i.e. an email or username).
      

      If I changed my service to instead return the below, the Connector works and logs me in.

      return response.status(200).json({
          user: {
              'id': '647978c5-01a0-49b8-8f4f-daab25e7ce63',
              'password': 'password',
              'active': true,
              'email': email,
              'username': email
          }
      });
      

      Either a Connector should work with only a UUID, or the code and docs should change to say it requires email and username too.

      danD 1 Reply Last reply Reply Quote 0
      • danD
        dan @fusionauth.qhj5e
        last edited by

        @fusionauth-qhj5e

        Hmmm. Which docs were you looking at?

        https://fusionauth.io/docs/lifecycle/migrate-users/connectors/ says:

        If you are migrating a user, you must provide the following fields in the user object you return.

        user.username or user.email
        user.id: a FusionAuth compatible UUID
        

        and

        If you are authenticating a user, you must provide the following fields in the user object you return.

        user.username or user.email
        user.id: a FusionAuth compatible UUID
        

        If there's another place in the docs that state that email/username is not required, would love to correct it.

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        F 1 Reply Last reply Reply Quote 0
        • F
          fusionauth.qhj5e @dan
          last edited by

          @dan Oh I see. The error in the response says:

          "because it was missing a unique id in the [user.id] or enough information to store in FusionAuth (i.e. an email or username)"

          In other words, "either Id or email" is missing from your request. Which makes boolean sense when thinking about it carefully.

          But when first reading it, I though it meant "you need either Id or email", which is very different. I supplied one of those. I though that was what the "or" meant.

          This error could be better as:

          "because it was missing a unique id in the [user.id] or enough information to store in FusionAuth (i.e. an email or username). Both are necessary"

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