How can I get token for alfresco authorization

cancel
Showing results for 
Search instead for 
Did you mean: 
hilal
Active Member II

How can I get token for alfresco authorization

Jump to solution

I use community edition and ı want to try alfresco rest api on postman. But ı get 401 unauthorize message while trying rest api. I think, it wants a token . But  ı dont know how can ı token locally. Thanks.

1 Solution

Accepted Solutions
edcearl
Member II

Re: How can ı get token for alfresko authorization

Jump to solution

In postman: (note that I am using Alfresco CE 201702, but this should work back to 5.0)

Set the URL to http(s)://hostSmiley Tongueort/alfresco/api/-default-/public/authentication/versions/1/tickets 

Leave the Authorization tab blank

In the 'Body' tab, change the data type to 'raw' and select JSON (application/json) from the dropdown

In the body enter:

{
"userId": "yourusernamehere",
"password": "passwordinplaintext"
}

Hit send.. 

I should note that I am not using the tickets feature in my REST API calls. I am adding basic auth headers to all requests. If you want to go that route just enter your username/password in the Authorization table and click Update Request. That will add a new header to the HTTP request containing your username/password.  

Finally, the API-explorer add-on is wonderful. I deployed it on my test server and you can try out all the REST APIs without having to use Postman. You have to build it yourself, but it is IMHO worth the time to do. 

GitHub - Alfresco/rest-api-explorer: Public REST API Explorer 

View solution in original post

2 Replies
edcearl
Member II

Re: How can ı get token for alfresko authorization

Jump to solution

In postman: (note that I am using Alfresco CE 201702, but this should work back to 5.0)

Set the URL to http(s)://hostSmiley Tongueort/alfresco/api/-default-/public/authentication/versions/1/tickets 

Leave the Authorization tab blank

In the 'Body' tab, change the data type to 'raw' and select JSON (application/json) from the dropdown

In the body enter:

{
"userId": "yourusernamehere",
"password": "passwordinplaintext"
}

Hit send.. 

I should note that I am not using the tickets feature in my REST API calls. I am adding basic auth headers to all requests. If you want to go that route just enter your username/password in the Authorization table and click Update Request. That will add a new header to the HTTP request containing your username/password.  

Finally, the API-explorer add-on is wonderful. I deployed it on my test server and you can try out all the REST APIs without having to use Postman. You have to build it yourself, but it is IMHO worth the time to do. 

GitHub - Alfresco/rest-api-explorer: Public REST API Explorer 

hilal
Active Member II

Re: How can ı get token for alfresko authorization

Jump to solution

Thank you your answer. It runs successfully. I want to write in detail for help to encounter like my problem.

I pass usernameSmiley Tongueassword(But base64 encoded) Authorization field in header and it works without error.

Thank you again.