How Enable Liferay OAuth and REST-WS in Liferay 7.2?
- Liferay Version : 7.2 DXP
- Eclipse : Photon
- SDK : Liferay SDK
(Below Rest Service tested on Above version)
1)Create Rest Web-Service Using Liferay’s Module called rest module.
File->New Liferay Module Project
2)Provide Class Name and package path.
3)Your file structure would be like this.
4)Add Relevant Dependency
5) Deploy rest-module to liferay.
Control Panel->Configuration->OAuth 2 Administration->Add new application with following detail.
7)Go to the newly creation application then click on Scopes Tab.The deployed application is available now.
There are scope for read/write/delete data.
Make sure you check all checkbox like
- create/update/delete data on your behalf
- create/update/delete data on your behalf + read data on your behalf
- read data on your behalf
So you make post,put,delete and read request.
Apply Permission to created application for user.
Rest Applicatioin->Edit->Apply permission to user or relevant role so every user can create token otherwise admin only can create application.
8)Check that oauth is working or not by passing following parameter. It will provide token if it is working otherwise display error.
9)Now enter your rest webservice url with context path by entering token like below.
10) You can create different resource/controller as per module like spring controller.
You need to register each controller/resource like this.
1,560 total views, 3 views today