Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C:UsersHAP>curl -X POST -vu android-bookmarks:123456 http://localhost:8080/oau
- th/token -H "Accept: application/json" -d "password=password&username=jlong&gran
- t_type=password&scope=write&client_secret=123456&client_id=android-bookmarks"
- * Trying 127.0.0.1...
- * Connected to localhost (127.0.0.1) port 8080 (#0)
- * Server auth using Basic with user 'android-bookmarks'
- > POST /oauth/token HTTP/1.1
- > Authorization: Basic YW5kcm9pZC1ib29rbWFya3M6MTIzNDU2
- > User-Agent: curl/7.40.0
- > Host: localhost:8080
- > Accept: application/json
- > Content-Length: 113
- > Content-Type: application/x-www-form-urlencoded
- >
- * upload completely sent off: 113 out of 113 bytes
- < HTTP/1.1 200 OK
- < Server: Apache-Coyote/1.1
- < X-Content-Type-Options: nosniff
- < X-XSS-Protection: 1; mode=block
- < Cache-Control: no-cache, no-store, max-age=0, must-revalidate
- < Pragma: no-cache
- < Expires: 0
- < X-Frame-Options: DENY
- < Access-Control-Allow-Origin: *
- < Access-Control-Allow-Methods: POST,GET,OPTIONS,DELETE
- < Access-Control-Max-Age: 3600
- < Access-Control-Allow-Credentials: true
- < Access-Control-Allow-Headers: Origin,Accept,X-Requested-With,Content-Type,Acce
- ss-Control-Request-Method,Access-Control-Request-Headers,Authorization
- < Cache-Control: no-store
- < Pragma: no-cache
- < Content-Type: application/json;charset=UTF-8
- < Transfer-Encoding: chunked
- < Date: Sun, 04 Sep 2016 07:26:25 GMT
- <
- {"access_token":"8ac3b71e-9196-4f01-b128-4fe2cf99a1c6","token_type":"bearer","re
- fresh_token":"77a8657a-02fb-4e4a-a8bc-b2af5550540d","expires_in":40556,"scope":"
- write"}* Connection #0 to host localhost left intact
- curl -v http://localhost:8080/bookmarks -H "Authorization: Bearer 3f403c67-2edf-4f47-905a-6abbb530cc75"
- {
- "_embedded":{
- "bookmarkResourceList":[
- {
- "bookmark":{
- "id":15,
- "uri":"http://bookmark.com/1/jlong",
- "description":"A description"
- },
- "_links":{
- "bookmark-uri":{
- "href":"http://bookmark.com/1/jlong"
- },
- "bookmarks":{
- "href":"http://localhost:8080/bookmarks"
- },
- "self":{
- "href":"http://localhost:8080/bookmarks/15"
- }
- }
- },
- {
- "bookmark":{
- "id":16,
- "uri":"http://bookmark.com/2/jlong",
- "description":"A description"
- },
- "_links":{
- "bookmark-uri":{
- "href":"http://bookmark.com/2/jlong"
- },
- "bookmarks":{
- "href":"http://localhost:8080/bookmarks"
- },
- "self":{
- "href":"http://localhost:8080/bookmarks/16"
- }
- }
- }
- ]
- }
- }
- XMLHttpRequest cannot load http://localhost:8080/bookmarks.
- Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
- Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 401.
- XHR failed loading: GET "http://localhost:8080/bookmarks".
- $.ajax({
- url: 'http://localhost:8080/bookmarks',
- beforeSend: function (xhr) {
- xhr.setRequestHeader('Authorization', 'BEARER 3f403c67-2edf-4f47-905a-6abbb530cc75');
- },
- success: function (response) {
- console.log(response);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement