-
-
Save anonymous/d28463059758886c6e77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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