Spree Trading: User Login via API

I am pretty newbie to use Spreeand I just play with stable version 3.0.

I would like to register a user account in the store via the API (or something like that) using a chrome application called "Advanced REST client", then go to the store and see how the account is registered.

I could not find links to actions that include users or accounts through the API at https://guides.spreecommerce.com/api/ . However, I noticed that if you send a POST request to localhost: 3000 / login, which sends account information, you get a html-code of the store, which says that you have been successfully registered.

After that, I checked the browser cookies, and the storage session cookie was also successfully created. Finally, when I redirect the browser to the store (localhost: 3000), the account is not registered, but the cookie still remains.

I think this is due to the guest token created Spree, but I do not understand why it does not work.

I would appreciate any help to clear this, also, if you have an idea on how to get my goal, this will also be appreciated.

+4
source share
1 answer

REST, Chrome, API REST REST. api spi. Spree Api Auth Gem. api :

\curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d ' {"user":{"email":"camelmasa@gmail.com", "password":"camelmasa"}}' http://localhost:3000/api/users/sign_in

, . Spree , .

0

Source: https://habr.com/ru/post/1599555/


All Articles