Forum

restful api credentials

Posted in CategoryDevelopment
  • Martijn
    Martijn Mellema   ( User ) 8 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 ) 8 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 ) 8 months ago

    Ah yes, that works. Thanks!

  • Sunny
    Sunny    ( User ) 1 month ago

    That is not working for me. we have made mobile app for android on react native technology.

    User will enter the pin, on the basis of that numeric pin i have to idenfy user in database make send response true.

    login will be possible only by entering pin, not email and password.

    In postman : 

    url: localhost/akaunting/api/customers

    error: {"message":"Failed to authenticate because of bad credentials or an invalid authorization header.","status_code":401,"debug":

    kindly help as soon as possible

    I have searched little bit and found that its dingo package with transformer.

     

     

     

Please login or register to leave a response.