• 0Shopping Cart
Pragmaapps
  • Home
  • Plugins
  • Family Tracker
  • Blog
  • About Us
  • Login
  • Search
  • Menu Menu
Blog - Latest News
You are here: Home1 / Ultimate guide to integrate woocommerce authentication on mobile app2 / Android3 / Ultimate guide to integrate woocommerce authentication on mobile app

Ultimate guide to integrate woocommerce authentication on mobile app

July 12, 2016/in Android, Ecommerce, Woocommerce /by Pragmaapps
authenticate woocommerce app user

Woocommerce is the next generation open source digital commerce platform. Woocommerce2.6+ is the way to access the REST API. It is fully integrated with the WordPress REST API. This allows data to be created, read, updated, and deleted using requests in JSON format. The current REST API integration version is v1 which takes a first-order position in endpoints. While we were developing the app then REST API was not upgraded. We face too much problems to create user. We make call to create user from WordPress Documentation. But now REST API has been upgraded. Now REST API have call to create user. This new release offers unmatched flexibility to bring your commerce vision to life. It features a modular code base that enables easier customization, faster time-to-market, and greater deployment flexibility to public or private cloud environments. This article explains the essential steps to authenticate woocommerce app user.

First of all set up the WordPress JWT Authentication plugin on the server side to enable customer authentication. This plugin set up is an essential step for woocommerce user authentication.

To login user, first of all, create user with WP REST API. When the user  is created then API returns the token for that particular user. It has more secure login process for a user to enable access to Woocommerce REST API. The crux of login is as follows:

  • User requests access with a username and password
  • Application validates credentials
  • The application provides a signed token to the user.

Following are the steps to get the token and how to use it in API calls.

Step by step guide to authenticate Woocommerce app user

1. Request a token from the WordPress token service

Create a post call with header and body. In header pass the content type you want to send and in body username and password. We pass username in the body rather than email because WordPress authenticate the user by username.

Below API is used to get token:

POST  "http://your-host-name/wp-json/jwt-auth/v1/token"

with parameters

 -H "Content-Type: application/json"
 -d '{"username":"<user_name>","password": "<password>"}'

2. Receive Response with an authentication token from the token service

A successful request returns a response body with the token. For example:

 {"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC93b29jb21tZXJjZS5pcHJhZ21hdGVjaC5jb20iLCJpYXQiOjE0NjU2MzAxODYsIm5iZiI6MTQ2NTYzMDE4NiwiZXhwIjoxNDY2MjM0OTg2LCJkYXRhIjp7InVzZXIiOnsiaWQiOiI2In19fQ.GmcVQKssY6dLS_QXTHgxVITrJR3LAqp6Y0zuCTPSW2c", "user_email":"[email protected]", "user_nicename":"test", "user_display_name":"test"}

This signed token acts like an electronic key that lets the user to login into an app. When make web API calls, supply this token to prove user’s identity.

3. Retrieve User details

Use the below API to retrieve the details of above created user

GET http://your-host-name/wc-api/v3/customers/email/[email protected]

It will return the following response with the details of user.

{"customer":{"id":6,"created_at":"2016-04-13T11:39:09Z","email":"[email protected]","first_name":"test","last_name":"test","username":"test","role":"customer","last_order_id":"713","last_order_date":"2016-06-08T05:59:22Z","orders_count":1,"total_spent":"10.00","avatar_url":"http://0.gravatar.com/avatar/?s=96","billing_address":{"first_name":"test","last_name":"test","company":"","address_1":"Raj","address_2":"","city":"Sgnr","state":"","postcode":"335001","country":"India","email":"[email protected]","phone":"1234567890"},"shipping_address":{"first_name":"test","last_name":"test","company":"","address_1":"Raj","address_2":"","city":"","state":"","postcode":"","country":"India"}}}

After completing the above steps users are enabled to order any item and they can make a call to any API for which they are authorized to.

  • Benefits of Woocommerce REST API
  • Introduces new product attribute endpoints (GET, POST, PUT, and DELETE).
  • Includes category thumbnails on the requests for product/categories.
  • Involves new endpoints to get all product orders.

Conclusion

Woocommerce2.6+ has a great scalability with more flexible architecture . These login steps not only give easy access to the Woocommerce Rest API but also improve the security of the e-commerce store. These essential steps to authenticate woocommerce app user helps the developer to make a call for REST API. You can use these steps to your Woocommerce app user. Below are some apps in the market that use the above steps to login user

  • WooShopee – Woocommerce App – A smart app that follow these login steps.
  • WooSeller

Feel free to contact us regarding technical or any other help to setup your eCommerce store.

References

Woocommerce– Introduction to Subscriptions Developer Documentation.

Woocommerce REST API – Introduction to Woocommerce2.6+ api .

 

 

Ultimate guide to integrate woocommerce authentication on mobile app was last modified: July 12th, 2016 by Pragmaapps
Tags: Android, Authenticate Woocommerce app, login woocommerce, user login in woocommerce, woocommerce, woocommerce mobile app, Woocommerce user authentication
You might also like
WooCommerce mobile app Top 10 reasons why you should invest in WooCommerce Mobile App?
React Native Is React Native a good choice for developing consumer or business mobile app?
AWS mobile app AWS Mobile SDK – The quickest way to build a AWS mobile app
average order value Tips to boost average order value on your eCommerce store
Android 7.0 Top 9 reasons why you should upgrade in android 7.0?
Android Twilio voice Twilio voice: Receive Call On Your Android Mobile
Hashtag Mentions Simplest guidance to implement Hashtag Mentions in Android Mobile App
android libraries Top android libraries every android developer should use

Latest Products

  • Guest plugin $15.00
  • Pages Plugin with Events $138.00
  • Pages Plugin with Discussions $138.00

Latest Portfolio

  • TheArcJanuary 30, 2020 - 4:29 am
  • My Math NotebookJanuary 30, 2020 - 3:29 am
  • Lifesherpa – Behavioral training appsOctober 8, 2018 - 6:01 am

Categories

  • Amazon Cognito (1)
  • Android (57)
  • Android O (2)
  • AngularJS (2)
  • AWS (8)
  • Beacon (1)
  • Cloud Computing (4)
  • Corporate Websites (1)
  • Custom Applications (4)
  • Ecommerce (50)
  • Firebase (4)
  • Frontpage Article (1)
  • Google Maps Marker (1)
  • Hashtag in android (1)
  • Hashtag Mentions in android (1)
  • Home (87)
  • hybrid app (2)
  • Images (1)
  • iPhone & iPad (16)
  • Magento (28)
  • Media Recorder (1)
  • Mentions in android (1)
  • Mobile (50)
  • Mobile application (35)
  • Nodejs (3)
  • Online Communities (6)
  • PhoneGap (1)
  • Phpfox (10)
  • Platform Optimization (15)
  • Postman (1)
  • Prestashop (2)
  • React native (2)
  • Ruby on Rails (5)
  • Serverless (2)
  • SimpleSAMLphp (1)
  • Social Engine (54)
  • Social Networking (31)
  • Steemit (1)
  • Test cases Postman (1)
  • Uncategorized (6)
  • Woocommerce (5)
  • Wordpress (15)
Scroll to top
Pragma logo
  • Home
  • Plugins
  • Family Tracker
  • Blog
  • About Us
  • Login