question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] How to verify the API token using this library?

See original GitHub issue

How do I use this library to verify a token?

https://api.cloudflare.com/#user-api-tokens-verify-token This is the api endpoint with a curl example. I like to use this library to verify the given token.

something like

cf = CloudFlare.CloudFlare(token=legal_token)
cf.verify_token() # returns True
cf = CloudFlare.CloudFlare(token=illegal_token)
cf.verify_token() # returns False

can help me understand how to do this with this library?

Or a way to extract token details https://api.cloudflare.com/#user-api-tokens-token-details

Because I also want to check if the token has the right permissions.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
mahtincommented, Jun 22, 2022

@simkimsia - I added an example to call the correct API and print the result. Please try this.

See example_user_tokens.py

1reaction
mahtincommented, Jun 21, 2022

Like all API calls you just follow the API name to create a Python call.

    cf = CloudFlare.CloudFlare(token=legal_token)
    response = cf.user.verify.token()

Then follow the information on Cloudflare’s API page to see what values are returned. https://api.cloudflare.com/#user-api-tokens-verify-token

Hope that helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I verify a Google authentication API access token?
Using one of the Google API Client Libraries (e.g. Java, Node.js, PHP, Python) is the recommended way to validate Google ID tokens. https://developers.google....
Read more >
Authenticate with a backend server - Google Developers
Send the ID token to your server; Verify the integrity of the ID token. Using a Google API Client Library; Calling the tokeninfo...
Read more >
Authentication API Explorer - Auth0
Send a valid Access Token in the Authorization header, using the Bearer authentication scheme. An example is the Get User Info endpoint. In...
Read more >
Google Auth Library: Node.js Client
This library comes with an OAuth2 client that allows you to retrieve an access token and refreshes the token and retry the request...
Read more >
OAuth API verification FAQs - Google Cloud Platform Console ...
When you use OAuth 2.0 to get permission from your users to access this data, you use strings called scopes to specify the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found