How Do I Properly Set the Authorization Header in a cURL Request?

10 Replies, 1110 Views

Hey! For the curl authorization header, your Bearer token format looks good. Just ensure the token is active and has the right scope.

For Basic Auth, `-u` is the simplest, but if you wanna use headers, you’ll need to encode the credentials. Here’s a quick example:
```bash
curl -H "Authorization: Basic $(echo -n 'username:password' | base64)" https://api.example.com
```
Also, try using `-v` to see the full request/response—it might help debug the 401 error.

Messages In This Thread



Users browsing this thread: 1 Guest(s)