VirtoCommerce / vc-storefront-deprecated

VirtoCommerce Storefront for ASP.NET (.NET Framework) repository (DEPRECATED)
http://virtocommerce.com
Other
26 stars 112 forks source link

StoreFront Api Dose not Recognize Session made from other projects #64

Closed IbrahimMNada closed 7 years ago

IbrahimMNada commented 7 years ago

When i try to add an item to the cart with the quantity i want the api responses with the Quantity added everything thing is working fine but when i request the CartCount its zero , when i try to add a new utem to the cart it dose restart from zero although i added a few items seconds ago

When i add items: 101_Full.txt

When i Check the Cart: 102_Full.txt

tatarincev commented 7 years ago

Without preserving cookies in the first response that the storefront returns, your next request will be interpreted as from a new anonymous user and storefront will create a new empty cart for it. Solutions:

  1. You need to first redirect the user to back-office storefront, to receive auth cookies, then your client scripts will use it for each cross-domain API call from your store to the back-office storefront API.
  2. Use Token based authentication in back-office storefront API https://dev.to/samueleresca/developing-token-authentication-using-aspnet-core but it will require storefront customization with adding the support of this type of authentication. The other how-to for Asp.NET API 4.6.1 http://bitoftech.net/2014/07/16/enable-oauth-refresh-tokens-angularjs-app-using-asp-net-web-api-2-owin/