Giter VIP home page Giter VIP logo

Comments (5)

Alfrick avatar Alfrick commented on July 20, 2024 1

It works fine now.

Thanks!

from fusionauth-php-client.

robotdan avatar robotdan commented on July 20, 2024

The JSON response indicates you are not sending in a valid UUID for the applicationId field, and you will want to use loginId instead of email in the JSON body. Did you find an example using email somewhere?

{
  "fieldErrors": {
    "applicationId": [
      {
        "code": "[couldNotConvert]applicationId",
        "message": "Invalid [applicationId]. This must be a valid UUID String (e.g. 25a872da-bb44-4af8-a43d-e7bcb5351ebc)."
      }
    ],
    "loginId": [
      {
        "code": "[blank]loginId",
        "message": "You must specify the [loginId] property."
      }
    ],
    "password": [
      {
        "code": "[blank]password",
        "message": "You must specify the [password] property."
      }
    ],
    "userId": [
      {
        "code": "[couldNotConvert]userId",
        "message": "Invalid userId on the URL [api]. This must be a valid UUID String (e.g. 25a872da-bb44-4af8-a43d-e7bcb5351ebc)."
      }
    ]
  }
}

Your incoming JSON should look something like this
( https://fusionauth.io/docs/v1/tech/apis/login#authenticate-a-user )

{
  "applicationId": "fbbf82ff-cc36-4540-aa30-578a57f12e61",
  "loginId": "[email protected]",
  "password": "12345"
}

from fusionauth-php-client.

Alfrick avatar Alfrick commented on July 20, 2024

Thanks for your reply.

The email example is in the example code for this PHP documentation.

Even if I use the loginId instead of email in the JSON body, the error still persists.

If I echo the request array, it looks exactly as this example.

It seems this issue occurs when implementing the FusionAuth PHP client for making POST requests. While making GET requests, such as retrieveUserByEmail works fine, POST requests return errors.

Even the other POST requests seems to be having the same problem.

However, if I make POST requests using the FusionAuth API, without the PHP client library, everything works well.

from fusionauth-php-client.

robotdan avatar robotdan commented on July 20, 2024

I'll see if I can recreate.

from fusionauth-php-client.

robotdan avatar robotdan commented on July 20, 2024

Ah, I see your error. Change your call from

$result = $client->login(json_encode($request));

to

$result = $client->login($request);

the client handles the JSON encoding. I've corrected the example in the README.

from fusionauth-php-client.

Related Issues (16)

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.