0

I'm trying to use .netrc file to authenticate access to a service, but I can't make it use Bearer authentication type!

I can access the service without .netrc with the following command:

curl --header "Authorization: Bearer <TOKEN>" "http://<url/to/service>"

I use .netrc file with the following command:

curl --netrc-file "<path/to/.netrc>" "http://<url/to/service>"

The .netrc file looks like:

machine <server domain>
password <TOKEN>

When I try it, I got

{"message":"Basic Authentication has been disabled on this instance."}

I changed password with account in the .netrc file, but got the same response.

1
  • 2
    .netrc in curl only works with Basic-style user/password auth. It can not emit Authorization: Bearer .... That’s why you see Basic Authentication has been disabled. If you need Bearer tokens, you will have to use -H "Authorization: Bearer <token>" directly, or put that header in a ~/.curlrc (or --config file) instead of .netrc. Commented Sep 18 at 13:42

0

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.