Skip to content

Instantly share code, notes, and snippets.

@pilt
Created October 11, 2012 13:34
Show Gist options
  • Save pilt/3872292 to your computer and use it in GitHub Desktop.
Save pilt/3872292 to your computer and use it in GitHub Desktop.
if "HTTP_AUTHORIZATION" in self.request.META:
authorization = self.request.META["HTTP_AUTHORIZATION"]
auth_type, auth_value = authorization.split()[0:2]
if auth_type.lower() == "basic":
credentials = "%s:%s" % (self.client.key, self.client.secret)
if auth_value != b64encode(credentials):
raise InvalidClient('Client authentication failed.')
else:
raise InvalidClient('Client authentication failed.')
else:
raise InvalidClient('Client authentication failed.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment