Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    API giving error Route [auth.login] not defined

    General Discussion
    4
    10
    1483
    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.
    • N
      neha.ak3018 last edited by

      How can I use Bagisto as an backend only.
      I want to use its API for my project which I am making on React, But it seems Bagisto API is based on sessions because when I am trying to call the services like (api/customers, wishlist, profile, my orders) all are giving me error "Route [auth.login] not defined."

      Please help me how can I achieve it. I am making frontend with React only. I have to use its API in my mobile app also.

      Screenshot 2020-06-14 at 1.42.54 PM.png

      1 Reply Last reply Reply Quote 0
      • S
        shivam-webkul last edited by

        Hello @neha-ak3018 ,

        Please follow the below link

        https://github.com/bagisto/bagisto/issues/1974

        Thanks

        1 Reply Last reply Reply Quote 0
        • N
          neha.ak3018 last edited by

          I am already sending Content-Type as application/json

          1 Reply Last reply Reply Quote 0
          • S
            shivam-webkul last edited by

            Hello,

            Then you need to first send the token true that means first customer will logged in then you can access all that apis.

            1 Reply Last reply Reply Quote 0
            • K
              kishanmodi last edited by

              Screenshot from 2020-06-26 17-33-50.png Screenshot from 2020-06-26 17-33-58.png

              Hello,
              I set Content-type as application/json and token as true but i am not able to get my proper response it appear Error as i attach snap please help me.

              1 Reply Last reply Reply Quote 0
              • S
                shivam-webkul last edited by

                Hello ,

                Please verify that issue that is already raised on git
                ref - https://github.com/bagisto/bagisto/issues/1974

                Thnaks

                1 Reply Last reply Reply Quote 0
                • _
                  _developer_12 last edited by

                  Hello,

                  I got the point about auth.login but can you please suggest about:

                  1. what route should be set for auth.login
                  2. I am using following code to run api (ref laravel api doc)

                  $response = $client->request('POST', '/api/orders', [
                  'headers' => [
                  'Accept' => 'application/json',
                  ],
                  'form_params' => [
                  'api_token' => $token,
                  ],
                  ]);

                  Note: $token is the values of the "api_token" column saved in the customer table.

                  I am getting following response in postman:
                  {
                  "error": "Unauthenticated"
                  }

                  Please suggest what I am missing? how should get authentication to run api?

                  Many Thanks

                  1 Reply Last reply Reply Quote 0
                  • S
                    shivam-webkul last edited by

                    Hello,

                    your all code is right , but please verify your code by this

                    $response = $client->request('POST', '/api/orders', [
                        'headers' => [
                            'Accept' => 'application/json',
                            'Authorization' => 'Bearer '.$accessToken,
                        ],
                    'form_params' => [
                    'api_token' => $token,
                    ],
                    ]);
                    
                    1 Reply Last reply Reply Quote 0
                    • _
                      _developer_12 last edited by

                      Thanks for your reply.

                      In the above code, we assuming for values as:

                      $token = It is the values of the "api_token" column saved in the customer table.

                      Please suggest how to get 'Bearer' $accessToken value?

                      Thanks

                      1 Reply Last reply Reply Quote 0
                      • S
                        shivam-webkul last edited by

                        Hello, @_developer_12

                        Actually, for the both token and api_token you can pass the $token then try to send the request i hope your issue has been resolved,

                        Thanks

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