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 customAuthenticationExtension object. Only the onTokenIssuanceStartCustomExtension object type is supported.
You can specify the following properties when creating a customAuthenticationExtension. You must specify the @odata.type property with a value of the customAuthenticationExtension object type that you want to create. For example, to create an onTokenIssuanceStartCustomExtension object, set @odata.type to #microsoft.graph.onTokenIssuanceStartCustomExtension.
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new OnTokenIssuanceStartCustomExtension
{
OdataType = "#microsoft.graph.onTokenIssuanceStartCustomExtension",
DisplayName = "onTokenIssuanceStartCustomExtension",
Description = "Fetch additional claims from custom user store",
EndpointConfiguration = new HttpRequestEndpoint
{
OdataType = "#microsoft.graph.httpRequestEndpoint",
TargetUrl = "https://authenticationeventsAPI.contoso.com",
},
AuthenticationConfiguration = new AzureAdTokenAuthentication
{
OdataType = "#microsoft.graph.azureAdTokenAuthentication",
ResourceId = "api://authenticationeventsAPI.contoso.com/a13d0fc1-04ab-4ede-b215-63de0174cbb4",
},
ClientConfiguration = new CustomExtensionClientConfiguration
{
TimeoutInMilliseconds = 2000,
MaximumRetries = 1,
},
ClaimsForTokenConfiguration = new List<OnTokenIssuanceStartReturnClaim>
{
new OnTokenIssuanceStartReturnClaim
{
ClaimIdInApiResponse = "DateOfBirth",
},
new OnTokenIssuanceStartReturnClaim
{
ClaimIdInApiResponse = "CustomRoles",
},
},
};
var result = await graphClient.Identity.CustomAuthenticationExtensions.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 custom-authentication-extensions create --body '{\
"@odata.type": "#microsoft.graph.onTokenIssuanceStartCustomExtension",\
"displayName": "onTokenIssuanceStartCustomExtension",\
"description": "Fetch additional claims from custom user store",\
"endpointConfiguration": {\
"@odata.type": "#microsoft.graph.httpRequestEndpoint",\
"targetUrl": "https://authenticationeventsAPI.contoso.com"\
},\
"authenticationConfiguration": {\
"@odata.type": "#microsoft.graph.azureAdTokenAuthentication",\
"resourceId": "api://authenticationeventsAPI.contoso.com/a13d0fc1-04ab-4ede-b215-63de0174cbb4"\
},\
"clientConfiguration": {\
"timeoutInMilliseconds": 2000,\
"maximumRetries": 1\
},\
"claimsForTokenConfiguration": [\
{\
"claimIdInApiResponse": "DateOfBirth"\
},\
{\
"claimIdInApiResponse": "CustomRoles"\
}\
]\
}\
'
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();
OnTokenIssuanceStartCustomExtension customAuthenticationExtension = new OnTokenIssuanceStartCustomExtension();
customAuthenticationExtension.displayName = "onTokenIssuanceStartCustomExtension";
customAuthenticationExtension.description = "Fetch additional claims from custom user store";
HttpRequestEndpoint endpointConfiguration = new HttpRequestEndpoint();
endpointConfiguration.targetUrl = "https://authenticationeventsAPI.contoso.com";
customAuthenticationExtension.endpointConfiguration = endpointConfiguration;
AzureAdTokenAuthentication authenticationConfiguration = new AzureAdTokenAuthentication();
authenticationConfiguration.resourceId = "api://authenticationeventsAPI.contoso.com/a13d0fc1-04ab-4ede-b215-63de0174cbb4";
customAuthenticationExtension.authenticationConfiguration = authenticationConfiguration;
CustomExtensionClientConfiguration clientConfiguration = new CustomExtensionClientConfiguration();
clientConfiguration.timeoutInMilliseconds = 2000;
clientConfiguration.maximumRetries = 1;
customAuthenticationExtension.clientConfiguration = clientConfiguration;
LinkedList<OnTokenIssuanceStartReturnClaim> claimsForTokenConfigurationList = new LinkedList<OnTokenIssuanceStartReturnClaim>();
OnTokenIssuanceStartReturnClaim claimsForTokenConfiguration = new OnTokenIssuanceStartReturnClaim();
claimsForTokenConfiguration.claimIdInApiResponse = "DateOfBirth";
claimsForTokenConfigurationList.add(claimsForTokenConfiguration);
OnTokenIssuanceStartReturnClaim claimsForTokenConfiguration1 = new OnTokenIssuanceStartReturnClaim();
claimsForTokenConfiguration1.claimIdInApiResponse = "CustomRoles";
claimsForTokenConfigurationList.add(claimsForTokenConfiguration1);
customAuthenticationExtension.claimsForTokenConfiguration = claimsForTokenConfigurationList;
graphClient.identity().customAuthenticationExtensions()
.buildRequest()
.post(customAuthenticationExtension);
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 OnTokenIssuanceStartCustomExtension();
$requestBody->setOdataType('#microsoft.graph.onTokenIssuanceStartCustomExtension');
$requestBody->setDisplayName('onTokenIssuanceStartCustomExtension');
$requestBody->setDescription('Fetch additional claims from custom user store');
$endpointConfiguration = new HttpRequestEndpoint();
$endpointConfiguration->setOdataType('#microsoft.graph.httpRequestEndpoint');
$endpointConfiguration->setTargetUrl('https://authenticationeventsAPI.contoso.com');
$requestBody->setEndpointConfiguration($endpointConfiguration);
$authenticationConfiguration = new AzureAdTokenAuthentication();
$authenticationConfiguration->setOdataType('#microsoft.graph.azureAdTokenAuthentication');
$authenticationConfiguration->setResourceId('api://authenticationeventsAPI.contoso.com/a13d0fc1-04ab-4ede-b215-63de0174cbb4');
$requestBody->setAuthenticationConfiguration($authenticationConfiguration);
$clientConfiguration = new CustomExtensionClientConfiguration();
$clientConfiguration->setTimeoutInMilliseconds(2000);
$clientConfiguration->setMaximumRetries(1);
$requestBody->setClientConfiguration($clientConfiguration);
$claimsForTokenConfigurationOnTokenIssuanceStartReturnClaim1 = new OnTokenIssuanceStartReturnClaim();
$claimsForTokenConfigurationOnTokenIssuanceStartReturnClaim1->setClaimIdInApiResponse('DateOfBirth');
$claimsForTokenConfigurationArray []= $claimsForTokenConfigurationOnTokenIssuanceStartReturnClaim1;
$claimsForTokenConfigurationOnTokenIssuanceStartReturnClaim2 = new OnTokenIssuanceStartReturnClaim();
$claimsForTokenConfigurationOnTokenIssuanceStartReturnClaim2->setClaimIdInApiResponse('CustomRoles');
$claimsForTokenConfigurationArray []= $claimsForTokenConfigurationOnTokenIssuanceStartReturnClaim2;
$requestBody->setClaimsForTokenConfiguration($claimsForTokenConfigurationArray);
$result = $graphServiceClient->identity()->customAuthenticationExtensions()->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 = OnTokenIssuanceStartCustomExtension(
odata_type = "#microsoft.graph.onTokenIssuanceStartCustomExtension",
display_name = "onTokenIssuanceStartCustomExtension",
description = "Fetch additional claims from custom user store",
endpoint_configuration = HttpRequestEndpoint(
odata_type = "#microsoft.graph.httpRequestEndpoint",
target_url = "https://authenticationeventsAPI.contoso.com",
),
authentication_configuration = AzureAdTokenAuthentication(
odata_type = "#microsoft.graph.azureAdTokenAuthentication",
resource_id = "api://authenticationeventsAPI.contoso.com/a13d0fc1-04ab-4ede-b215-63de0174cbb4",
),
client_configuration = CustomExtensionClientConfiguration(
timeout_in_milliseconds = 2000,
maximum_retries = 1,
),
claims_for_token_configuration = [
OnTokenIssuanceStartReturnClaim(
claim_id_in_api_response = "DateOfBirth",
),
OnTokenIssuanceStartReturnClaim(
claim_id_in_api_response = "CustomRoles",
),
]
)
result = await graph_client.identity.custom_authentication_extensions.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.