{% include navmenu.html %}
In this exercise, we will note the additional capabilities that are enabled by authenticating as a DSpace user in Postman.
To illustrate the process, we will step through the authentication process manually.
Use the URL and credentials in the footer of this page.
Note: Postman does provide a mechanism to script authentication.
api/authn/status
In the return section, note that authentication is false.
Make a POST call to api/authn/login without any credentials, in order to get a response with a generated DSPACE-XSRF-TOKEN (see the response's Header).
For POST api/authn/login' request, modify the Header as follows: Content-Type= application/x-www-form-urlencoded and X-XSRF-TOKEN= DSPACE-XSRF-TOKEN's value (from previous step) Modify the body as follows(form-urlencoded): user= yourUsername, password= yourPassword After modifying the Body and the Header, make a new POST request to api/authn/login`
Note that the credentials you need to use will differ from the screenshot below.
If all authentication details are correct, you should receive a 200 status code, and in the Header of the response, you will find an 'Authorization' token. This token is your Bearer token, and should be provided in all future calls as Bearer Token (as authentication method). In all future cals, also keep in the Header section the X-XSRF-TOKEN provided previously.
With the Bearer Token and the X-XSRF-TOKEN, you should be able to get authenticated using
GET api/authn/status
In the return section, note that authentication is true.
As long as you continue to use the tab that contains this Bearer token, you will continue to be authenticated. If the Bearer token times out, repeat the steps above to generate a new one.
Rerun the queries that you ran in Exercise 2. Note the result count.
api/discover/search/objects
api/discover/search/objects?query=research
How does this compare to your unauthenticated results?
You can verify this by running the same query in a different tab (without the Bearer token) and note the difference in counts.
It is possible to create and delete objects through Postman.
In this process, you will perform the underlying tasks that the DSpace Angular client will perform on behalf of a user.
Set in the Header: Content-Type= multipart/form-data, X-XSRF-TOKEN= token received at login. Also dont forget to give the Bearer Token for Authenticaation. The body must be set as multipart and must be empty. Make the call to
POST api/submission/workspaceitems
Note the id of the object that is created.
GET api/submission/workspaceitems/[id]
Note the error section where missing mandatory metadata and sections are listed
DELETE api/submission/workspaceitems/[id]
GET api/submission/workspaceitems/[id]
{% include credentials.html %} {% include nav.html %}




