• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

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

API giving error Route [auth.login] not defined

General Discussion
4
10
1.5k
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 14 Jun 2020, 08:14

    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 16 Jun 2020, 05:50

      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 18 Jun 2020, 11:00

        I am already sending Content-Type as application/json

        1 Reply Last reply Reply Quote 0
        • S
          shivam-webkul last edited by 24 Jun 2020, 16:11

          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 26 Jun 2020, 12:07

            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
            • 19 days later
            • S
              shivam-webkul last edited by 15 Jul 2020, 07:05

              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 17 Jul 2020, 18:09

                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 20 Jul 2020, 13:53

                  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 22 Jul 2020, 08:27

                    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 24 Jul 2020, 12:27

                      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
                      8 out of 10
                      • First post
                        8/10
                        Last post