0

I want to use spree api on frontend to implement the ajax products search just like the one in orders/edit on backend where you enter 4 characters and it uses api to get variants.

But I am confused about the token. how can i use the following on frontend even when the user is not logged in.

/api/variants?q[product_name_or_sku_cont]=product&token=sometoken

I had a similar problem with updating cart using api (check here) but i solved that using order_token=current_order.guest_token

but here i want to implement a search and when a new user visits the site current_order is empty.

Thanks

Community
  • 1
  • 1
Aitizazk
  • 332
  • 1
  • 4
  • 16

1 Answers1

0

I have change Spree::Api::Config[:requires_authentication] to false and now i am able to access it without a token

Aitizazk
  • 332
  • 1
  • 4
  • 16