Forum

restful api credentials

Posted In CategoryDevelopment
  • Martijn
    Martijn Mellema   ( User ) 2 months ago

    Hi,

     

    I would like to use your api. But I cannot figure out on what kind of headers I must set. I get an response from the server when doing an  get request to  /api/categories. 

     

    {

        "message": "Failed to authenticate because of bad credentials or an invalid authorization header.",

        "status_code": 401,

        "debug": {

            "line": 113,

            "file": "/opt/akaunting/vendor/dingo/api/src/Auth/Auth.php",

            "class": "Symfony\\Component\\HttpKernel\\Exception\\UnauthorizedHttpException",

            "trace": [

                "#0 /opt/akaunting/vendor/dingo/api/src/Auth/Auth.php(96): Dingo\\Api\\Auth\\Auth->throwUnauthorizedException(Array)",

                "#1 /opt/akaunting/vendor/dingo/api/src/Http/Middleware/Auth.php(52): Dingo\\Api\\Auth\\Auth->authenticate(Array)",

                "#2 /opt/akaunting/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Dingo\\Api\\Http\\Middleware\\Auth->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",

     

    But what are the keys I must set in the headers. Is it:

    username, password 

    or 

    email password. 

     

    I've tried all of them, but still no response.  Can you send me and curl example if possible?

  • Denis
    Denis Duliçi   ( Admin ) 2 months ago

    Hello Martijn, you should use the email and password. Make sure your REST client is using HTTP Basic authentication.

  • Martijn
    Martijn Mellema   ( User ) 2 months ago

    Ah yes, that works. Thanks!

Please login or register to leave a response.