1

I am trying to set up a integration with a REST API, that requires a Base64 encoded key to authenticate, and I cannot seem to get it to work.

The API only returns:

<Code>-4</Code><Message>Not Authenticated</Message>
"Please provide a valid username and password"

My request looks like this:

curl -i 
-H 'application/json'
-X GET 
-H 'basic :Base64EncodedKey' 
http://se.api.anpdm.com/v1/filter/all

No username should be supplied, thats why I use : before the key.

Can someone please try to help me? I am not a developer, I am just in charge of generating code examples.

/Max

1
  • curl -i -XGET --user username:password -H "Content-Type: application/json" "http://...." where you should replace username and password with its actual values Commented Apr 4, 2017 at 9:17

2 Answers 2

2

A little trick of generate your base64 encode:

echo -n admin:123456 | base64
YWRtaW46MTIzNDU2

Then use it like this:

curl -H "Authorization: Basic YWRtaW46MTIzNDU2" http://nexus.xxxxcloud.com/nexus/service/local/artifact/maven/content
Sign up to request clarification or add additional context in comments.

Comments

1

The header is Authorization: Basic Base64EncodedKey. You are missing the Authorization portion in your header.

-H 'Authorization: Basic Base64EncodedKey' 

1 Comment

Works like a charm! :-) Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.