Skip to content

OAuth2

The OAuth2 service collection provides operations for managing OAuth2 access tokens used to authenticate with the CrowdStrike API. All API requests require a valid bearer token generated through this collection. Use these operations to generate new access tokens and revoke previously issued tokens before their standard 30-minute expiry.

LanguageLast Update
Pythonv1.6.5
PowerShellv2.2.9
Gov0.22.0
TypeScriptv0.6.0
Rustv0.7.1
Rubyv1.4.0


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

Generate an OAuth2 access token

Method POST
Route /oauth2/token
PEP 8 token
client_id body · string
The API client ID to authenticate your API requests. For information on generating API clients, see API documentation inside Falcon.
client_secret body · string
The API client secret to authenticate your API requests. For information on generating API clients, see API documentation inside Falcon.
member_cid body · string
For MSSP Master CIDs, optionally lock the token to act on behalf of this member CID
alter_state body · boolean
Flag indicating if the underlying authentication state is changed by this request.
from falconpy import OAuth2
falcon = OAuth2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.token(alter_state=boolean)
print(response)
{
"access_token": "string",
"expires_in": 0,
"id_token": "string",
"issued_token_type": "string",
"refresh_token": "string",
"scope": "string",
"token_type": "string"
}


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

Method POST
Route /oauth2/revoke
PEP 8 revoke
client_id body · string
The OAuth2 client ID you are revoking the token for.
token body · string
The OAuth2 access token you want to revoke. Include your API client ID and secret in basic auth format (Authorization: basic <encoded API client ID and secret>) in your request header.
alter_state body · boolean
Flag indicating if the underlying authentication state is changed by this request.
from falconpy import OAuth2
falcon = OAuth2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.revoke(client_id="string",
token="string",
alter_state=boolean)
print(response)
{
"errors": [
{
"code": 0,
"id": "string",
"message": "string"
}
],
"meta": {
"pagination": {
"limit": 0,
"offset": 0,
"total": 0
},
"powered_by": "string",
"query_time": 0.0,
"trace_id": "string",
"writes": {
"resources_affected": 0
}
}
}