CrowdStrike Falcon Twitter URL

Using the OAuth2 service collection

Uber class support Service class support Documentation Version Page Updated

Table of Contents

Operation IDDescription
oauth2RevokeToken
PEP 8revoke
Revoke a previously issued OAuth2 access token before the end of its standard 30-minute lifespan.
oauth2AccessToken
PEP 8token
Generate an OAuth2 access token

Passing credentials

WARNING

client_id and client_secret are input variables that contain your CrowdStrike API credentials. Please note that all examples below do not hard code these values. (These values are ingested as strings.)

CrowdStrike does not recommend hard coding API credentials or customer identifiers within source code.

oauth2RevokeToken

Revoke a previously issued OAuth2 access token before the end of its standard 30-minute lifespan.

PEP8 method name

revoke

Content-Type

  • Consumes: application/x-www-form-urlencoded
  • Produces: application/json

Keyword Arguments

NameServiceUberTypeData typeDescription
data
Service Class Support

Uber Class Support
formDatastringFull data payload in JSON format containing the OAuth2 access token you want to revoke.
token
Service Class Support

Uber Class Support
formDatastringThe OAuth2 access token you want to revoke.

Usage

Service class example (PEP8 syntax)
from falconpy import OAuth2

# Do not hardcode API credentials!
falcon = OAuth2(client_id=CLIENT_ID,
                client_secret=CLIENT_SECRET
                )

response = falcon.revoke(token="string")
print(response)

Service class example (Operation ID syntax)
from falconpy import OAuth2

# Do not hardcode API credentials!
falcon = OAuth2(client_id=CLIENT_ID,
                client_secret=CLIENT_SECRET
                )

response = falcon.oauth2RevokeToken(token="string")
print(response)

Uber class example
from falconpy import APIHarness

# Do not hardcode API credentials!
falcon = APIHarness(client_id=CLIENT_ID,
                    client_secret=CLIENT_SECRET
                    )

PAYLOAD = {
    "token": "string"
}

response = falcon.command("oauth2RevokeToken", data=PAYLOAD)
print(response)

oauth2AccessToken

Generate an OAuth2 access token

PEP8 method name

token

Content-Type

  • Consumes: application/x-www-form-urlencoded
  • Produces: application/json

Keyword Arguments

NameServiceUberTypeData typeDescription
data
Service Class Support

Uber Class Support
formDatastringFull data payload in JSON format containing your API credentials. CID scoping can also be provided here.

Usage

Service class example (PEP8 syntax)

This example will generate a token using the credentials provided when creating an instance of the Service Class.

from falconpy import OAuth2

# Do not hardcode API credentials!
falcon = OAuth2(client_id=CLIENT_ID,
                client_secret=CLIENT_SECRET
                )

response = falcon.token()
print(response)

Service class example (Operation ID syntax)

This example will generate a token using the credentials provided when creating an instance of the Service Class.

from falconpy import OAuth2

# Do not hardcode API credentials!
falcon = OAuth2(client_id=CLIENT_ID,
                client_secret=CLIENT_SECRET
                )

response = falcon.oauth2AccessToken()
print(response)

Uber class example

This example demonstrates generating a token that is potentially different than the token generated when you create an instance of the Uber class.

from falconpy import APIHarness

# Do not hardcode API credentials!
falcon = APIHarness(client_id=CLIENT_ID,
                    client_secret=CLIENT_SECRET
                    )

PAYLOAD = {
    "client_id": "string",
    "client_secret": "string",
    "member_cid": "string"
}

response = falcon.command("oauth2AccessToken", data=PAYLOAD)
print(response)