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

    Error GET /api/user/registration/{userId}/{applicationId}

    Scheduled Pinned Locked Moved Solved
    Q&A
    2
    3
    1.9k
    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.
    • R
      rwheelerflemming
      last edited by

      Hi FusionAuth community.

      First off, I love the product. I managed to get an instance of FusionAuth running locally on my machine. And, following along with the blog post - https://fusionauth.io/blog/2021/11/11/how-to-authenticate-your-react-app/ - everything was going smoothly.

      That is until I got to the portion of the blog where I was asked to hit the following API endpoint:

      GET /api/user/registration/{userId}/{applicationId}

      My response to this get request is:

      {
        status: 500,
        statusText: '',
        headers: {
          'cache-control': 'no-store',
          'content-type': 'application/json;charset=UTF-8',
          'content-length': '216',
          date: 'Thu, 13 Jan 2022 06:21:24 GMT',
          connection: 'close'
        },
        config: {
          transitional: {
            silentJSONParsing: true,
            forcedJSONParsing: true,
            clarifyTimeoutError: false
          },
          adapter: [Function: httpAdapter],
          transformRequest: [ [Function: transformRequest] ],
          transformResponse: [ [Function: transformResponse] ],
          timeout: 0,
          xsrfCookieName: 'XSRF-TOKEN',
          xsrfHeaderName: 'X-XSRF-TOKEN',
          maxContentLength: -1,
          maxBodyLength: -1,
          validateStatus: [Function: validateStatus],
          headers: {
            Accept: 'application/json, text/plain, */*',
            Authorization: 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx',
            'Content-Type': 'application/json',
            'User-Agent': 'axios/0.24.0'
          },
          method: 'get',
          url: 'http://localhost:9011/api/user/registration/8ccf9b6d-2ffa-45d8-ac33-1e5d30cc2c73/5d4efa2d-1db4-4dd3-b1ef-87b325e4c3b7',
          data: undefined
        },
        request: <ref *1> ClientRequest {
          _events: [Object: null prototype] {
            abort: [Function (anonymous)],
            aborted: [Function (anonymous)],
            connect: [Function (anonymous)],
            error: [Function (anonymous)],
            socket: [Function (anonymous)],
            timeout: [Function (anonymous)],
            prefinish: [Function: requestOnPrefinish]
          },
          _eventsCount: 7,
          _maxListeners: undefined,
          outputData: [],
          outputSize: 0,
          writable: true,
          destroyed: false,
          _last: true,
          chunkedEncoding: false,
          shouldKeepAlive: false,
          _defaultKeepAlive: true,
          useChunkedEncodingByDefault: false,
          sendDate: false,
          _removedConnection: false,
          _removedContLen: false,
          _removedTE: false,
          _contentLength: 0,
          _hasBody: true,
          _trailer: '',
          finished: true,
          _headerSent: true,
          socket: Socket {
            connecting: false,
            _hadError: false,
            _parent: null,
            _host: 'localhost',
            _readableState: [ReadableState],
            _events: [Object: null prototype],
            _eventsCount: 7,
            _maxListeners: undefined,
            _writableState: [WritableState],
            allowHalfOpen: false,
            _sockname: null,
            _pendingData: null,
            _pendingEncoding: '',
            server: null,
            _server: null,
            parser: null,
            _httpMessage: [Circular *1],
            [Symbol(async_id_symbol)]: 78,
            [Symbol(kHandle)]: [TCP],
            [Symbol(kSetNoDelay)]: false,
            [Symbol(lastWriteQueueSize)]: 0,
            [Symbol(timeout)]: null,
            [Symbol(kBuffer)]: null,
            [Symbol(kBufferCb)]: null,
            [Symbol(kBufferGen)]: null,
            [Symbol(kCapture)]: false,
            [Symbol(kBytesRead)]: 0,
            [Symbol(kBytesWritten)]: 0,
            [Symbol(RequestTimeout)]: undefined
          },
          _header: 'GET /api/user/registration/8ccf9b6d-2ffa-45d8-ac33-1e5d30cc2c73/5d4efa2d-1db4-4dd3-b1ef-87b325e4c3b7 HTTP/1.1\r\n' +
            'Accept: application/json, text/plain, */*\r\n' +
            'Authorization: xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx\r\n' +
            'Content-Type: application/json\r\n' +
            'User-Agent: axios/0.24.0\r\n' +
            'Host: localhost:9011\r\n' +
            'Connection: close\r\n' +
            '\r\n',
          _keepAliveTimeout: 0,
          _onPendingData: [Function: noopPendingOutput],
          agent: Agent {
            _events: [Object: null prototype],
            _eventsCount: 2,
            _maxListeners: undefined,
            defaultPort: 80,
            protocol: 'http:',
            options: [Object],
            requests: {},
            sockets: [Object],
            freeSockets: {},
            keepAliveMsecs: 1000,
            keepAlive: false,
            maxSockets: Infinity,
            maxFreeSockets: 256,
            scheduling: 'lifo',
            maxTotalSockets: Infinity,
            totalSocketCount: 1,
            [Symbol(kCapture)]: false
          },
          socketPath: undefined,
          method: 'GET',
          maxHeaderSize: undefined,
          insecureHTTPParser: undefined,
          path: '/api/user/registration/8ccf9b6d-2ffa-45d8-ac33-1e5d30cc2c73/5d4efa2d-1db4-4dd3-b1ef-87b325e4c3b7',
          _ended: true,
          res: IncomingMessage {
            _readableState: [ReadableState],
            _events: [Object: null prototype],
            _eventsCount: 3,
            _maxListeners: undefined,
            socket: [Socket],
            httpVersionMajor: 1,
            httpVersionMinor: 1,
            httpVersion: '1.1',
            complete: true,
            headers: [Object],
            rawHeaders: [Array],
            trailers: {},
            rawTrailers: [],
            aborted: false,
            upgrade: false,
            url: '',
            method: null,
            statusCode: 500,
            statusMessage: '',
            client: [Socket],
            _consuming: false,
            _dumped: false,
            req: [Circular *1],
            responseUrl: 'http://localhost:9011/api/user/registration/8ccf9b6d-2ffa-45d8-ac33-1e5d30cc2c73/5d4efa2d-1db4-4dd3-b1ef-87b325e4c3b7',
            redirects: [],
            [Symbol(kCapture)]: false,
            [Symbol(RequestTimeout)]: undefined
          },
          aborted: false,
          timeoutCb: null,
          upgradeOrConnect: false,
          parser: null,
          maxHeadersCount: null,
          reusedSocket: false,
          host: 'localhost',
          protocol: 'http:',
          _redirectable: Writable {
            _writableState: [WritableState],
            _events: [Object: null prototype],
            _eventsCount: 2,
            _maxListeners: undefined,
            _options: [Object],
            _ended: true,
            _ending: true,
            _redirectCount: 0,
            _redirects: [],
            _requestBodyLength: 0,
            _requestBodyBuffers: [],
            _onNativeResponse: [Function (anonymous)],
            _currentRequest: [Circular *1],
            _currentUrl: 'http://localhost:9011/api/user/registration/8ccf9b6d-2ffa-45d8-ac33-1e5d30cc2c73/5d4efa2d-1db4-4dd3-b1ef-87b325e4c3b7',
            [Symbol(kCapture)]: false
          },
          [Symbol(kCapture)]: false,
          [Symbol(kNeedDrain)]: false,
          [Symbol(corked)]: 0,
          [Symbol(kOutHeaders)]: [Object: null prototype] {
            accept: [Array],
            authorization: [Array],
            'content-type': [Array],
            'user-agent': [Array],
            host: [Array]
          }
        },
        data: { generalErrors: [ [Object] ] }
      } 
      {"generalErrors":[{"code":"[Exception]","message":"FusionAuth encountered an unexpected error. Please review the troubleshooting guide found in the documentation for assistance and the available support channels."}]}
      

      Status 500

      Node JS code:

      const userRegistrationInfo = await axios.get(`http://localhost:${FUSION_AUTH_PORT}/api/user/registration/${introspectResponse.data.sub}/${NILLIE_OAUTH_APPLICATION_ID}`,
                {
                  headers: {
                    "Authorization": `${FUSION_API_KEY}`,
                    "Content-Type": "application/json",
                  },
                }
              );
      

      Postman

      http://localhost:9011/api/user/registration/b38e9e36-0c89-40be-b1ff-26450803a7d7/5d4efa2d-1db4-4dd3-b1ef-87b325e4c3b7
      
      Headers:
      Authorization: <API KEY>
      Content-Type: application/json
      
      
      • The UUID of the 'sub' matches the user that was previously registered to the application
      • The UUID of the Application ID is correct

      The result from the introspection of the token received is:

        data: {
          active: true,
          applicationId: '5d4efa2d-1db4-4dd3-b1ef-87b325e4c3b7',
          aud: '5d4efa2d-1db4-4dd3-b1ef-87b325e4c3b7',
          authenticationType: 'PASSWORD',
          email: 'email@gmail.com',
          email_verified: true,
          exp: 1642037551,
          iat: 1642033951,
          iss: 'mywebsite.com',
          jti: '48682850-f41c-484c-a3dc-61fd0efab6dc',
          roles: [ 'user' ],
          sub: '8ccf9b6d-2ffa-45d8-ac33-1e5d30cc2c73'
        }
      

      Any ideas on what could cause this issue? Thank you.

      R 1 Reply Last reply Reply Quote 0
      • R
        rwheelerflemming @rwheelerflemming
        last edited by

        Please close this. I'm a moron and was using the Key ID instead actually clicking and revealing the Key Value.

        Everything is good!

        joshuaJ 1 Reply Last reply Reply Quote 1
        • R rwheelerflemming has marked this topic as solved on
        • joshuaJ
          joshua @rwheelerflemming
          last edited by

          @rwheelerflemming

          Please close this. I'm a moron and was using the Key ID instead actually clicking and revealing the Key Value.

          Trust me when I say this - We have all been there RE: pebcak. 🙂

          Glad you got it figured out!

          Thanks,
          Josh

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