Skip to content

Instantly share code, notes, and snippets.

Created November 19, 2014 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d28463059758886c6e77 to your computer and use it in GitHub Desktop.
Save anonymous/d28463059758886c6e77 to your computer and use it in GitHub Desktop.
def verify_token(user_token, admin_token, admin_endpoint, tenant):
# Verify a user token via private endpoint.
# Requires the user token to be verified, an admin token and the private admin endpoint.
print 'Verifying token: ' + user_token
admin_client = client.Client(token=user_token, auth_url=admin_endpoint)
try:
result = admin_client.tokens.authenticate(token=user_token)
print 'The result is: ' + json.dumps(result.token, indent=4)
except Unauthorized as u:
print 'Unauthorized: ' + u.message
except Exception as e:
print 'Exception: ' + e.message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment