# 401 Unauthorized in Go

The server accepted the request shape but rejected your credentials or scheme. Paste your curl command to see what Go (net/http) would send and compare against the working request.

## Example

```bash
curl https://api.example.com/me \
  -H "Authorization: Bearer YOUR_TOKEN"
```

## What the converter handles

- Double-check the Authorization header, ensure the token hasn't expired, and confirm the scheme (Bearer vs Basic vs API key) matches what the docs specify.
- Use the Explain panel to enumerate exactly which headers, cookies, and TLS flags the curl request carries.
- The In-browser Runner is a fast way to confirm whether the failure reproduces from the browser or only from the server.

## Common mistakes

- Comparing curl and Go without capturing both actual wire requests — mitmproxy or Charles pays off here.
- Assuming a working curl means the API is happy — client differences (redirect handling, keep-alive, HTTP/2) surface as edge cases.
- Silencing warnings instead of fixing them — every Go client has a way to log the outgoing request; turn it on.

## FAQ

### Why does curl work but Go fail?

Usually a header curl adds by default is missing in Go, or vice versa. Paste the curl above to see a normalized breakdown.

### Is my request sent to Toolpaper?

No. Parsing and diffing run in your browser.

---

Source: https://toolpaper.manavdev.site/how-to/curl-401-in-go · Language hub: https://toolpaper.manavdev.site/curl-to-go