DELAPARRA
Index
Color
NL
Category: HTTP headers

WWW-Authenticate

Explained by Updated

What is WWW-Authenticate?

WWW-Authenticate: Sent with 401 Unauthorized — tells the client what auth scheme is required. WWW-Authenticate is sent with a 401 Unauthorized response to tell the client how to authenticate. WWW-Authenticate: Bearer realm="api", error="invalid_token" says a bearer token is required and the one sent was invalid. Browsers react to Basic in this header by showing a login dialog, which is how simple password protection on staging sites works.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about WWW-Authenticate

What should you keep in mind with WWW-Authenticate?

For APIs, including this header with a clear error code helps clients understand what went wrong: missing token, expired token or insufficient scope. That lets an app refresh its token automatically instead of logging the user out. Note that Basic authentication sends credentials in an easily decoded form, so only use it over HTTPS, and prefer proper login or token-based authentication for anything beyond a temporary barrier.

What does an example of WWW-Authenticate look like?

WWW-Authenticate: Bearer realm="api", error="invalid_token"

At a glance

CategoryHTTP headers
Explained by
Updated

More HTTP headers terms

All terms starting with W

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.