Logging in wordpress user with Oauth token - wordpress

Is it possible to allow loggin in user into wordpress(woo commerce) with Oauth token? And also adding data to user cart is possible with REST API?

It's possible. You can use cocart plugin for cart operations. But it doesn't support authentication.
https://wordpress.org/plugins/cart-rest-api-for-woocommerce/
You can examine "JWT Authentication for WP REST API" plugin for authentication.
https://tr.wordpress.org/plugins/jwt-authentication-for-wp-rest-api/

Related

How to use FireBase Authentication for SSO

How can one use Firebase to SSO into some product?
Firebase is a federated IdP, meaning, they handle the auth flows for other IdPs, ie Google, Facebook, Twitter, etc.
So how can I set up a product with SSO that is expecting some kind of Auth flow, ie OIDC, SAML, when FireBase doesn't necessarily do that? Note, I am comfortable building my own login pages and using the FireBase SDK, I'm just not sure where to start.
Let's take Google for example. I can easily setup Google SSO for my product. I just generate a client ID/Secret in the Google Dashboard, and then use Google's OAuth flow.
My product initiates the login and redirects to Google for logins
Google identifies my user and redirects to my product's callback URL
Done, user is logged in
How would I do the same thing in FireBase, which is a sort of middleman between my product and Google?
If you have your own user auth system, and you want to integrate that with Firebase Auth for the purpose of creating accounts that integrate with other Firebase products, you can write a custom authentication provider. Your backend will take the user's credentials and create a custom auth token that the app can use to sign in the user.

Facebook Login With WP JWT Auth

We are using WP JWT Auth plugin to login user to WordPress from wp rest API. WP JWT Auth plugin requires a password to get the token, now when we are integrating facebook login, I am not sure how to get the user logged in since we won't be having passwords from facebook.
Any suggestions?
Yesterday I opened a bounty for your question and today I'm answering it!
You will need two WordPress plugins: stionic users and nextend social login (you need to configure it on order for stionic to work. Watch the video on that page in order to know how to configure it)
When done you could send a post request to https://example.com/wp-json/wp/v2/m_facebook/loginin postman and you will notice that you will get the same token that you get when logging in https://example.com/wp-json/jwt-auth/v1/token
After that, you can configure facebook ionic plugin and you are done.
JSON API User plugin is an alternative but I haven't tried it
Useful tutorials
Facebook ionic login - Wordpress ionic login

How to authenticate existing customer via WooCommerce rest API

I am creating a mobile app for a WooCommerce website and have gotten to a stage where I want the user to login or signup to the WooCommerce website before they continue with a purchase.
I can create a new customer no problem but I am having trouble when trying to authenticate an existing customer. After looking at the rest api docs for WooCommerce, I haven't come across any endpoint that will allow an existing user to log in to their account. Is there any endpoint that will allow me to do this that isn't documented?
There might be other ways but what comes to my mind immediately is to use JWT Authentication for WP REST API plugin.
Using this plugin you can request for authentication on the server using the username and password. It will return a token if successful. Then use the token for checking if this user/customer is valid. If valid, use wc api to create an order for this customer.

woocommerce validate user name and password via rest api

I am developing an android app for an eCommerce site that is built in wp-woocommerce.
I really don't know much about wp.
I have read http://woothemes.github.io/woocommerce-rest-api-docs/ and have developed almost all the android app. but I was unable to find a way to validate the username and password of the customer via rest API.
I just want to pass the username and password and expect the result as pass or fail.
Thanks in advance for your kind help.
Unfortunately, WooCommerce REST API doesn't deal with login/logout (customers) as they are treated as WordPress users with CUSTOMER roles.
The API KEY and SECRETE is for your app to fetch data as products - orders etc... You have to use WordPress API login methods to access user information, signup new users/customers,.
WordPress REST API / Auth
If you prefer to use JWT there is many plugins in the plugins repo.I have used this one: Simple JWT Login – Login and Register to WordPress using JWT and works good.

WooCommerce Rest API - how to authenticate customers? [duplicate]

I am creating a mobile app for a WooCommerce website and have gotten to a stage where I want the user to login or signup to the WooCommerce website before they continue with a purchase.
I can create a new customer no problem but I am having trouble when trying to authenticate an existing customer. After looking at the rest api docs for WooCommerce, I haven't come across any endpoint that will allow an existing user to log in to their account. Is there any endpoint that will allow me to do this that isn't documented?
There might be other ways but what comes to my mind immediately is to use JWT Authentication for WP REST API plugin.
Using this plugin you can request for authentication on the server using the username and password. It will return a token if successful. Then use the token for checking if this user/customer is valid. If valid, use wc api to create an order for this customer.

Resources