Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WC API v2 - Ability to login customer #6126

Closed
artemkolotilkin opened this issue Aug 28, 2014 · 14 comments
Closed

WC API v2 - Ability to login customer #6126

artemkolotilkin opened this issue Aug 28, 2014 · 14 comments
Labels
needs: author feedback The issue/PR needs a response from any of the parties involved in the issue.

Comments

@artemkolotilkin
Copy link

Hi,

I've started to use WC API v2 and it works great for me so far. One thing that is missing - the ability to login customer in order to get associated orders and other information. I understand that it may be considered to be out of the scope of this plugin, but since it allows to register customers (POST /customers), it will also make sense to be able to login them. I'd prefer not to use the whole another plugin for that if that could be added into WC API.

Also, this would allow to use WooCommerce as a back-end solution and have a separate front-end app that will handle user registration and login, as well as creating orders, etc.

Let me know your thoughts please.

@maxrice
Copy link
Contributor

maxrice commented Aug 29, 2014

Can you explain your use case more here? Do you want the API to be able to make calls under the context of a user that you create via the API? Or are you wanting it to return the auth cookie for a given user so you can log them in client-side?

@Kenshino
Copy link

Sounds like what https://wordpress.org/plugins/user-switching/ does

*Regards, Jon Ang *

On Fri, Aug 29, 2014 at 12:01 PM, Max Rice notifications@github.com wrote:

Can you explain your use case more here? Do you want the API to be able to
make calls under the context of a user that you create via the API? Or are
you wanting it to return the auth cookie for a given user so you can log
them in client-side?


Reply to this email directly or view it on GitHub
#6126 (comment)
.

@artemkolotilkin
Copy link
Author

I'm developing a mobile app that uses WooCommerce as a back-end store. I'm pulling all the products via API and allow users to purchase them using the API. During the checkout process user can create an account and this is available via "create customer" method. What is missing is the ability for a user to login next time or on a different device. It will be enough for me to have a method that exchanges username/email with password for a corresponding customer id, so that I can use it to pull customer's orders. Hope it makes sense.

@maxrice
Copy link
Contributor

maxrice commented Aug 29, 2014

There's an endpoint to find a customer by email :)

@artemkolotilkin
Copy link
Author

:-)
I saw that, but without proper authentication process anyone will be able to get access to other accounts and make orders there. Sounds a little bit insecure...

I can create a method for login if it makes sense for you guys to include it into the API. It will be very similar to registration, but instead of creating a customer it will try to login a user and return user object on success.

@maxrice
Copy link
Contributor

maxrice commented Aug 29, 2014

I think I understand what you're asking, though it seems like something your app would need to handle internally. If you can do a quick mock up of the login method you're thinking of, that would be helpful to see what you need 😸

@artemkolotilkin
Copy link
Author

I agree that login functionality feels outside of the scope for this module. But at the same time since the current API handles 99% of my needs it feels like an overkill to have a separate API plugin just for the login piece.

I'll create a Pull Request once I finish with the login method.

@artemkolotilkin
Copy link
Author

A new endpoint is implemented and works fine for me. I did a few tests and found no issues. Can you guys take a look and merge it if it looks fine for you as well? Thanks.

@maxrice maxrice added the API label Aug 30, 2014
@mikejolley
Copy link
Member

Discussion in #6133

@okezieokpara
Copy link

@artemkolotilkin please share the endpoint that works for this issue, I am experiencing it too.

@artemkolotilkin
Copy link
Author

You can find the code in this discussion:
#6133

@crushman1
Copy link

Has the login ability been added to version 3 of the api? Im trying to build an android app for my woocommerce website and I can't find the password field when I query the table with the rest api client library. I need to build a login page for customers.

@claudiosanches
Copy link
Contributor

@crushman1 Not and for security reasons it will never be implemented.

@crushman1
Copy link

@claudiosmweb I think I understand the security risk, however I to give the customer some sort of login page. What other options do I have?

@woocommerce woocommerce locked and limited conversation to collaborators Feb 2, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: author feedback The issue/PR needs a response from any of the parties involved in the issue.
Projects
None yet
Development

No branches or pull requests

7 participants