API giving error Route [auth.login] not defined
-
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.
-
Hello @neha-ak3018 ,
Please follow the below link
https://github.com/bagisto/bagisto/issues/1974
Thanks
-
I am already sending Content-Type as application/json
-
Hello,
Then you need to first send the token true that means first customer will logged in then you can access all that apis.
-
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. -
Hello ,
Please verify that issue that is already raised on git
ref - https://github.com/bagisto/bagisto/issues/1974Thnaks
-
Hello,
I got the point about auth.login but can you please suggest about:
- what route should be set for auth.login
- 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
-
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, ], ]);
-
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
-
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