APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Create a new authenticationEventListener object. You can create one of the following subtypes that are derived from authenticationEventListener.
You can specify the following properties when creating an authenticationEventListener. You must specify the @odata.type property to specify the type of authenticationEventListener to create; for example, @odata.type": "microsoft.graph.onTokenIssuanceStartListener".
Property
Type
Description
authenticationEventsFlowId
String
The identifier of the authentication events flow. Optional.
The handler to invoke when conditions are met. Can be set for the onUserCreateStartListener listener type.
priority
Int32
The priority of this handler. Between 0 (lower priority) and 1000 (higher priority). Required.
Response
If successful, this method returns a 201 Created response code and an authenticationEventListener object in the response body. The @odata.type property specifies the type of the created object.
Examples
Request
The following is an example of a request to create a onTokenIssuanceStartListener.
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new OnTokenIssuanceStartListener
{
OdataType = "#microsoft.graph.onTokenIssuanceStartListener",
Conditions = new AuthenticationConditions
{
Applications = new AuthenticationConditionsApplications
{
IncludeAllApplications = false,
IncludeApplications = new List<AuthenticationConditionApplication>
{
new AuthenticationConditionApplication
{
AppId = "a13d0fc1-04ab-4ede-b215-63de0174cbb4",
},
},
},
},
Priority = 500,
Handler = new OnTokenIssuanceStartCustomExtensionHandler
{
OdataType = "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler",
CustomExtension = new OnTokenIssuanceStartCustomExtension
{
Id = "6fc5012e-7665-43d6-9708-4370863f4e6e",
},
},
};
var result = await graphClient.Identity.AuthenticationEventListeners.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc-beta identity authentication-event-listeners create --body '{\
"@odata.type": "#microsoft.graph.onTokenIssuanceStartListener",\
"conditions": {\
"applications": {\
"includeAllApplications": false,\
"includeApplications": [\
{\
"appId": "a13d0fc1-04ab-4ede-b215-63de0174cbb4"\
}\
]\
}\
},\
"priority": 500,\
"handler": {\
"@odata.type": "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler",\
"customExtension": {\
"id": "6fc5012e-7665-43d6-9708-4370863f4e6e"\
}\
}\
}\
'
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
OnTokenIssuanceStartListener authenticationEventListener = new OnTokenIssuanceStartListener();
AuthenticationConditions conditions = new AuthenticationConditions();
AuthenticationConditionsApplications applications = new AuthenticationConditionsApplications();
applications.includeAllApplications = false;
LinkedList<AuthenticationConditionApplication> includeApplicationsList = new LinkedList<AuthenticationConditionApplication>();
AuthenticationConditionApplication includeApplications = new AuthenticationConditionApplication();
includeApplications.appId = "a13d0fc1-04ab-4ede-b215-63de0174cbb4";
includeApplicationsList.add(includeApplications);
AuthenticationConditionApplicationCollectionResponse authenticationConditionApplicationCollectionResponse = new AuthenticationConditionApplicationCollectionResponse();
authenticationConditionApplicationCollectionResponse.value = includeApplicationsList;
AuthenticationConditionApplicationCollectionPage authenticationConditionApplicationCollectionPage = new AuthenticationConditionApplicationCollectionPage(authenticationConditionApplicationCollectionResponse, null);
applications.includeApplications = authenticationConditionApplicationCollectionPage;
conditions.applications = applications;
authenticationEventListener.conditions = conditions;
authenticationEventListener.priority = 500;
OnTokenIssuanceStartCustomExtensionHandler handler = new OnTokenIssuanceStartCustomExtensionHandler();
OnTokenIssuanceStartCustomExtension customExtension = new OnTokenIssuanceStartCustomExtension();
customExtension.id = "6fc5012e-7665-43d6-9708-4370863f4e6e";
handler.customExtension = customExtension;
authenticationEventListener.handler = handler;
graphClient.identity().authenticationEventListeners()
.buildRequest()
.post(authenticationEventListener);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OnTokenIssuanceStartListener();
$requestBody->setOdataType('#microsoft.graph.onTokenIssuanceStartListener');
$conditions = new AuthenticationConditions();
$conditionsApplications = new AuthenticationConditionsApplications();
$conditionsApplications->setIncludeAllApplications(false);
$includeApplicationsAuthenticationConditionApplication1 = new AuthenticationConditionApplication();
$includeApplicationsAuthenticationConditionApplication1->setAppId('a13d0fc1-04ab-4ede-b215-63de0174cbb4');
$includeApplicationsArray []= $includeApplicationsAuthenticationConditionApplication1;
$conditionsApplications->setIncludeApplications($includeApplicationsArray);
$conditions->setApplications($conditionsApplications);
$requestBody->setConditions($conditions);
$requestBody->setPriority(500);
$handler = new OnTokenIssuanceStartCustomExtensionHandler();
$handler->setOdataType('#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler');
$handlerCustomExtension = new OnTokenIssuanceStartCustomExtension();
$handlerCustomExtension->setId('6fc5012e-7665-43d6-9708-4370863f4e6e');
$handler->setCustomExtension($handlerCustomExtension);
$requestBody->setHandler($handler);
$result = $graphServiceClient->identity()->authenticationEventListeners()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(request_adapter)
request_body = OnTokenIssuanceStartListener(
odata_type = "#microsoft.graph.onTokenIssuanceStartListener",
conditions = AuthenticationConditions(
applications = AuthenticationConditionsApplications(
include_all_applications = False,
include_applications = [
AuthenticationConditionApplication(
app_id = "a13d0fc1-04ab-4ede-b215-63de0174cbb4",
),
]
),
),
priority = 500,
handler = OnTokenIssuanceStartCustomExtensionHandler(
odata_type = "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler",
custom_extension = OnTokenIssuanceStartCustomExtension(
id = "6fc5012e-7665-43d6-9708-4370863f4e6e",
),
),
)
result = await graph_client.identity.authentication_event_listeners.post(body = request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.