Unable to test on Basic Functionality using REST API

Hi…
I’ve added the Rest API addon successfully… When i tried to invoke the Rest API thru the Postman. I’m getting the following error… Please help me to resolve the issue…
Screenshot from 2020-04-24 19-23-03

{
    "error": "invalid_grant",
    "error_description": "User is not allowed to use the REST API"
}

Hi @Narayanan,

Take a look at Security in REST API.

REST API defines its own REST security scope. You should configure a separate set of roles that includes cuba.restApi.enabled specific permission for users logging in to the system through the REST API. If you don’t do it, the users will not be able to log in via REST.

Hope it helps.

Regards,
Peterson.

I had the same problem last day - the solution is easy but the documentation is not quite correct at the moment, when the example is just followed.

In version 7.2 CUBA introduced a concept of security scopes .

From the CUBA documentation:

The REST API add-on defines its own REST scope, so if you add it to the project, you should configure a separate set of roles for users logging in to the system through the REST API. If you don’t do it, the users will not be able to login via REST because they won’t have any permissions including the cuba.restApi.enabled specific permission.

So you have to create new role, say My REST role , in role editor select the REST value in Security scope lookup field. Then enable the cuba.restApi.enabled specific permission. After that add all permissions that are required (entities, attributes, etc.)

3 Likes