I am using curl command to fetch the manifest file of the singularity image as below
curl -H "Authorization :"
and it is working fine for me and i am able to fetch the manifest file andi it is working without appending Bearer
but when I append Bearer string in the Authorization header as below
curl -H "Authorization : Bearer "
curl command is failing to fetch the manifest
but actually it should work when we appended Bearer to Authorization header and it should fail when we dont append Bearer to Authorization header right
why is this happening so and where am i going wrong?
Related
I am trying to create mirrors on my GitLab via API and I am able to do that just fine. Problem appears when I try to create a mirror to an address that has URL encoded space "%20" in it.
When I call git lab API with following curl:
curl --request POST --data 'url=https://user:password#remotegit.com/Repo%20Mirror%20Test/_git/Repo%20Mirror%20Test' --data "enabled=true" --header "Authorization: Bearer TOKEN" "https://mygit.com/api/v4/projects/171/remote_mirrors"
I get following response:
{"id":171,"enabled":true,"url":null,"update_status":"none","last_update_at":null,"last_update_started_at":null,"last_successful_update_at":null,"last_error":null,"only_protected_branches":false,"keep_divergent_refs":null}
"url":null does not appear when I use any other address without "%20"
When I do this via UI with the same URL it works just fine. I tried to change " for ' to stop any expansion from happening but no luck. In UI I also looked to Developer tools if there is anything different but string is sent in the same format, unchanged.
GitLab server version: 15.2.2
Any ideas what could cause this problem?
All right the whole URL needed to be encoded, you can do that in "https://www.urlencoder.org" or in my case I needed to use it in Bash script so I installed a package "gridsite-clients" which contains "urlencode" which does basically the same thing. Once the address was encoded all worked as expected. So the final request would look like this:
curl --request POST --data 'url=https%3A%2F%2Fuser%3Apassword%40remotegit.com%2FRepo%2520Mirror%2520Test%2F_git%2FRepo%2520Mirror%2520Test' --data "enabled=true" --header "Authorization: Bearer TOKEN" "https://mygit.com/api/v4/projects/171/remote_mirrors"
I am trying to automate file uploads to SharePoint Online. Problem is I keep getting 401 unauthorized error when trying to upload the files. I created a script to retrieve the token as suggested in curl request to Microsoft Sharepoint API?, but uploads are still failing, even though I do get a positive response when running curl -i -H "Authorization: Bearer $(./get_access_token.sh)" -H "Accept: application/json;odata=verbose" -s "https://YourTenant.sharepoint.com/_api/web". I have afeeling that I am just malforming my curl command. Any suggestion on command format to be using?
There is a problem with NodeJS v7.9.0 where there can be a request
curl -i -H Accept:application/json -H range:bytes=1-8 -X GET http://localhost:8080/examples/text.txt
However node's request header doesn't match when it is logged
console.log(req.headers.range)
The logged value varies between different values for the exact same request
(some values logged from that request: bytes=1-2, bytes=1-3, bytes=1-4, bytes=1-5, bytes=1-6, bytes=1, 7 bytes=1-8)
Is this a problem with NodeJS or something else with the computer's setup? And how does one fix it
Note the requests are being made with "Rest Web service client" (chrome plugin), and the request above is the equivalent curl command.
I am doing example of Spring Boot Security with wso2is server from this post https://github.com/angel-git/wso2is-springoauth, when I am trying to access resource with access token I am getting
{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}
I am generating access token by:
curl -u CLIENT_ID:CLIENT_SECRET-k -d
"grant_type=password&username=admin&password=admin" -H
"Content-Type:application/x-www-form-urlencoded"
https://localhost:9443/oauth2/token
and accessing resources by:
curl -H GET "Authorization: ACCESS_TOKEN"
http://localhost:8080/greeting
I found many solution on stackoverflow but unfortunately could not solve my issue
please help, thank you
I was getting the same error message for
"curl http://localhost:8080/spring4/beans" :
{"timestamp":1493591079040,"status":401,"error":"Unauthorized","message":"Full authentication is required to access this resource.","path":"/spring4/beans"}
Setting the below property in application.properties bypassed the security check & I could use all the acuator endpoints:
management.security.enabled=false
Many thanx to Angel Gavalda who helped me to solved problem. I used following commands to generate access token and access resource
For Generating Access token:-
curl -k -d
'grant_type=client_credentials&client_id=yourClientId&client_secret=yourClientSecret'
https://localhost:9443/oauth2/token
For Accessing Resource:-
curl -k -H "Authorization: Bearer $ACCESS_TOKEN"
http://localhost:8080/greeting
When the answer above does not solve this issue change OAuthConfigurations/RemoveOAuthHeadersFromOutMessage to false in the file api-manager.xml.
I am using Cloud Foundry for Bluemix app creation in that curl operations having Authorization:bearer xxxxx token.
How can I include Authorization: bearer token in request module?
The plain open source Clound Foundry client is able to curl the api like this:
$ cf curl -X GET https://.../v2/...
for instance:
$ cf curl -X GET /v2/apps