mercredi 23 octobre 2019

Connecting to the app with the access token returns 401

I am trying to connect me into the Keycloak server that I deploy to upload a file with another web-app deployed that are connected.

export access_token=$(curl -X POST \
    -H 'Content-Type: application/x-www-form-urlencoded' \
    -d 'client_secret=fd8187db-f7c3-4f93-a58c-a10e3865dfe5&username=afvg&password=afvg&client_id=login-app&grant_type=password' \
    -v --noproxy localhost, http://localhost:8080/auth/realms/FocusocKeycloak/protocol/openid-connect/token | jq --raw-output '.access_token') 

curl -v -X POST \
  --noproxy localhost, http://localhost:38080/api/upload \
  -H "Authorization: Bearer "$access_token

Where in the first part, I take the access token to use it after in the access to app, but the second curl returns me Error 401,

< HTTP/1.1 401
< 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
< Content-Length: 0
< Date: Wed, 23 Oct 2019 12:01:49 GMT
<
* Curl_http_done: called premature == 0
* Connection #0 to host localhost left intact

Is something missing?




Aucun commentaire:

Enregistrer un commentaire