Resourcepolicy creation

74 views
Skip to first unread message

geethanjali alaguraj

unread,
Nov 28, 2023, 5:19:41 AM11/28/23
to DSpace Technical Support
Hello,

I have created a drop-down field in the registration page which is fetched the available community names.

Now i want to create a resource policy for the register eperson to the selected community id

I'm facing 401 unauthorized error for POST http://localhost:8080/server/api/authz/resourcepolicies?resource=93e64e4b-92f3-4da9-8db9-d3b2c74e99e2&eperson=63f4cca9-2adf-4471-a558-e17f7719273c

so i have tried to generate a constant jwt token to pass that in request header to resolve the error but not working due to secret key generation (tried through dspace frontend code).

Is anyone know hoe to generate the secret key through frontend or is that key has any formats, etc

Or else how can i give permit all the functionalities for resource policy creation for resolving unauthorized error.
how to change the permission through code?

DSpace Technical Support

unread,
Dec 4, 2023, 3:31:58 PM12/4/23
to DSpace Technical Support
Hi,

A 401 response means that you have not successfully authenticated with that backend.  It's not possible to do any POST request without first authenticating (as all POSTs are access restricted).  See our documentation on how to authenticate via the REST API.  https://github.com/DSpace/RestContract/blob/main/authentication.md

The frontend always uses the authentication options described there.  In fact, you can compare your request to what the frontend does by just logging in via the frontend & watching the requests your browser sends to the backend.  We have a guide for that in our hints on "Finding which REST API Endpoint to use" here: https://wiki.lyrasis.org/display/DSDOC7x/REST+API#RESTAPI-FindingwhichRESTAPIEndpointtouse

Tim

Reply all
Reply to author
Forward
0 new messages