From 9a429a1c2e3e1fa134b650bb7a9c8fb910c6cdc0 Mon Sep 17 00:00:00 2001 From: Jon Besga Date: Mon, 1 Jul 2019 02:55:54 +0200 Subject: [PATCH] Fix custom authentication example (#6640) --- docs/api-guide/authentication.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index 52650299f..d1939d774 100644 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -327,7 +327,7 @@ If the `.authenticate_header()` method is not overridden, the authentication sch ## Example -The following example will authenticate any incoming request as the user given by the username in a custom request header named 'X_USERNAME'. +The following example will authenticate any incoming request as the user given by the username in a custom request header named 'X-USERNAME'. from django.contrib.auth.models import User from rest_framework import authentication @@ -335,7 +335,7 @@ The following example will authenticate any incoming request as the user given b class ExampleAuthentication(authentication.BaseAuthentication): def authenticate(self, request): - username = request.META.get('X_USERNAME') + username = request.META.get('HTTP_X_USERNAME') if not username: return None