philipsorst / angular-rest-springsecurity

An example AngularJS Application that uses a Spring Security protected Jersey REST backend based on Hibernate/JPA
Apache License 2.0
620 stars 367 forks source link

How to contact your web service with a REST Client ? #28

Closed memento closed 8 years ago

memento commented 8 years ago

Hi,

Tanks for you work.

Can you tell us more about how to contact (only) your REST back end with Postman (example). What url do we have to enter ? For a local test, is it this one : http://localhost:8080/angular-rest-springsecurity/rest/user/authenticate ?

What type of authentication do we have to choose within the client ?

What's the scenario you have in mind ?

Best regards !

philipsorst commented 8 years ago

Hi,

all REST resources are available unter the "rest/" path. Generally you will use the "user/authenticate" path in order to obtain an access token by providing the username and password. Any subsequent (authenticated) requests to the REST API will the in include this access token, either by passing it in an "X-Auth-Token" Header or by appending it as a "?token=" parameter.

Hope that helps, regards

Philip

memento commented 8 years ago

Thanks !

But I still get a "405 not authorized method" when I send a GET (Type : Basic Auth) request on the URL : http://localhost:8080/angular-rest-springsecurity/rest/user/authenticate I generate a header with the admin/admin credentials. . To make it simple, if we refer to this page : https://www.getpostman.com/docs/helpers In wich case are we ?

Best regards and thanks again for you qwick answer.

philipsorst commented 8 years ago

Ok, to point that out, you need to perform a POST request with with the "username" and "password" parameters encoded as form parameters.

memento commented 8 years ago

Thank you for your quick answer!