Create b2xIdentityUserFlow
Article
03/02/2023
7 minutes to read
4 contributors
Feedback
In this article
Namespace: microsoft.graph
Create a new b2xIdentityUserFlow object.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
IdentityUserFlow.ReadWrite.All
Delegated (personal Microsoft account)
Not supported.
Application
IdentityUserFlow.ReadWrite.All
The work or school account needs to belong to one of the following roles:
Global administrator
External Identity User Flow administrator
HTTP request
POST /identity/b2xUserFlows
Name
Description
Authorization
Bearer {token}. Required.
Content-Type
application/json. Required.
Request body
In the request body, provide a JSON representation of a b2xIdentityUserFlow .
Property
Type
Description
id
String
Required. The name of the user flow. The name will be pre-pended with B2X_1
after creation.
userFlowType
String
Required. The type of user flow you are creating. This value will always be signUpOrSignIn
.
userFlowTypeVersion
Float
Required. The version of the user flow. This value will always be 1.
apiConnectorConfiguration
userFlowApiConnectorConfiguration
Optional. Configuration for enabling an API connector for use as part of the user flow.
Response
If successful, this method returns a 201 Created
response code and a Location header with a URI to the b2xIdentityUserFlow object created for this request, with the B2X_1
prefix added to the name. If unsuccessful, a 4xx
error will be returned with specific details.
Examples
Example 1: Create a user flow with the default values
Request
The following is an example of the request.
POST https://graph.microsoft.com/v1.0/identity/b2xUserFlows
Content-type: application/json
{
"id": "Partner",
"userFlowType": "signUpOrSignIn",
"userFlowTypeVersion": 1
}
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new B2xIdentityUserFlow
{
Id = "Partner",
UserFlowType = UserFlowType.SignUpOrSignIn,
UserFlowTypeVersion = 1f,
};
var result = await graphClient.Identity.B2xUserFlows.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const b2xIdentityUserFlow = {
id: 'Partner',
userFlowType: 'signUpOrSignIn',
userFlowTypeVersion: 1
};
await client.api('/identity/b2xUserFlows')
.post(b2xIdentityUserFlow);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
B2xIdentityUserFlow b2xIdentityUserFlow = new B2xIdentityUserFlow();
b2xIdentityUserFlow.id = "Partner";
b2xIdentityUserFlow.userFlowType = UserFlowType.SIGN_UP_OR_SIGN_IN;
b2xIdentityUserFlow.userFlowTypeVersion = 1;
graphClient.identity().b2xUserFlows()
.buildRequest()
.post(b2xIdentityUserFlow);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewB2xIdentityUserFlow()
id := "Partner"
requestBody.SetId(&id)
userFlowType := graphmodels.SIGNUPORSIGNIN_USERFLOWTYPE
requestBody.SetUserFlowType(&userFlowType)
userFlowTypeVersion := float32(1)
requestBody.SetUserFlowTypeVersion(&userFlowTypeVersion)
result, err := graphClient.Identity().B2xUserFlows().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new B2xIdentityUserFlow();
$requestBody->setId('Partner');
$requestBody->setUserFlowType(new UserFlowType('signuporsignin'));
$requestBody->setUserFlowTypeVersion(1);
$requestResult = $graphServiceClient->identity()->b2xUserFlows()->post($requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following is an example of the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/identity/b2xUserFlows/B2X_1_Partner
Content-type: application/json
{
"id": "B2X_1_Partner",
"userFlowType": "signUpOrSignIn",
"userFlowTypeVersion": 1
}
Example 2: Create a user flow with the default values and an identity provider
Request
The following is an example of the request.
POST https://graph.microsoft.com/v1.0/identity/b2xUserFlows
Content-type: application/json
{
"id": "Partner",
"userFlowType": "signUpOrSignIn",
"userFlowTypeVersion": 1,
"identityProviders": [
{
"id": "Facebook-OAuth",
"type": "Facebook",
"name": "Facebook"
}
]
}
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new B2xIdentityUserFlow
{
Id = "Partner",
UserFlowType = UserFlowType.SignUpOrSignIn,
UserFlowTypeVersion = 1f,
IdentityProviders = new List<IdentityProvider>
{
new IdentityProvider
{
Id = "Facebook-OAuth",
Type = "Facebook",
Name = "Facebook",
},
},
};
var result = await graphClient.Identity.B2xUserFlows.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const b2xIdentityUserFlow = {
id: 'Partner',
userFlowType: 'signUpOrSignIn',
userFlowTypeVersion: 1,
identityProviders: [
{
id: 'Facebook-OAuth',
type: 'Facebook',
name: 'Facebook'
}
]
};
await client.api('/identity/b2xUserFlows')
.post(b2xIdentityUserFlow);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
B2xIdentityUserFlow b2xIdentityUserFlow = new B2xIdentityUserFlow();
b2xIdentityUserFlow.id = "Partner";
b2xIdentityUserFlow.userFlowType = UserFlowType.SIGN_UP_OR_SIGN_IN;
b2xIdentityUserFlow.userFlowTypeVersion = 1;
LinkedList<IdentityProvider> identityProvidersList = new LinkedList<IdentityProvider>();
IdentityProvider identityProviders = new IdentityProvider();
identityProviders.id = "Facebook-OAuth";
identityProviders.type = "Facebook";
identityProviders.name = "Facebook";
identityProvidersList.add(identityProviders);
IdentityProviderCollectionResponse identityProviderCollectionResponse = new IdentityProviderCollectionResponse();
identityProviderCollectionResponse.value = identityProvidersList;
IdentityProviderCollectionPage identityProviderCollectionPage = new IdentityProviderCollectionPage(identityProviderCollectionResponse, null);
b2xIdentityUserFlow.identityProviders = identityProviderCollectionPage;
graphClient.identity().b2xUserFlows()
.buildRequest()
.post(b2xIdentityUserFlow);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewB2xIdentityUserFlow()
id := "Partner"
requestBody.SetId(&id)
userFlowType := graphmodels.SIGNUPORSIGNIN_USERFLOWTYPE
requestBody.SetUserFlowType(&userFlowType)
userFlowTypeVersion := float32(1)
requestBody.SetUserFlowTypeVersion(&userFlowTypeVersion)
identityProvider := graphmodels.NewIdentityProvider()
id := "Facebook-OAuth"
identityProvider.SetId(&id)
type := "Facebook"
identityProvider.SetType(&type)
name := "Facebook"
identityProvider.SetName(&name)
identityProviders := []graphmodels.IdentityProviderable {
identityProvider,
}
requestBody.SetIdentityProviders(identityProviders)
result, err := graphClient.Identity().B2xUserFlows().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new B2xIdentityUserFlow();
$requestBody->setId('Partner');
$requestBody->setUserFlowType(new UserFlowType('signuporsignin'));
$requestBody->setUserFlowTypeVersion(1);
$identityProvidersIdentityProvider1 = new IdentityProvider();
$identityProvidersIdentityProvider1->setId('Facebook-OAuth');
$identityProvidersIdentityProvider1->setType('Facebook');
$identityProvidersIdentityProvider1->setName('Facebook');
$identityProvidersArray []= $identityProvidersIdentityProvider1;
$requestBody->setIdentityProviders($identityProvidersArray);
$requestResult = $graphServiceClient->identity()->b2xUserFlows()->post($requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following is an example of the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/identity/b2xUserFlows/B2X_1_Partner
Content-type: application/json
{
"id": "B2X_1_Partner",
"userFlowType": "signUpOrSignIn",
"userFlowTypeVersion": 1
}
Example 3: Create a user flow with the default values and configuration for API connectors
Request
The following is an example of the request.
POST https://graph.microsoft.com/v1.0/identity/b2xUserFlows
Content-type: application/json
{
"id": "UserFlowWithAPIConnector",
"userFlowType": "signUpOrSignIn",
"userFlowTypeVersion": 1,
"apiConnectorConfiguration":{
"postFederationSignup":{
"@odata.id": "https://graph.microsoft.com/v1/identity/apiConnectors/{id}"
},
"postAttributeCollection":{
"@odata.id": "https://graph.microsoft.com/v1/identity/apiConnectors/{id}"
}
}
}
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new B2xIdentityUserFlow
{
Id = "UserFlowWithAPIConnector",
UserFlowType = UserFlowType.SignUpOrSignIn,
UserFlowTypeVersion = 1f,
ApiConnectorConfiguration = new UserFlowApiConnectorConfiguration
{
PostFederationSignup = new IdentityApiConnector
{
AdditionalData = new Dictionary<string, object>
{
{
"@odata.id" , "https://graph.microsoft.com/v1/identity/apiConnectors/{id}"
},
},
},
PostAttributeCollection = new IdentityApiConnector
{
AdditionalData = new Dictionary<string, object>
{
{
"@odata.id" , "https://graph.microsoft.com/v1/identity/apiConnectors/{id}"
},
},
},
},
};
var result = await graphClient.Identity.B2xUserFlows.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const b2xIdentityUserFlow = {
id: 'UserFlowWithAPIConnector',
userFlowType: 'signUpOrSignIn',
userFlowTypeVersion: 1,
apiConnectorConfiguration: {
postFederationSignup: {
'@odata.id': 'https://graph.microsoft.com/v1/identity/apiConnectors/{id}'
},
postAttributeCollection: {
'@odata.id': 'https://graph.microsoft.com/v1/identity/apiConnectors/{id}'
}
}
};
await client.api('/identity/b2xUserFlows')
.post(b2xIdentityUserFlow);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
B2xIdentityUserFlow b2xIdentityUserFlow = new B2xIdentityUserFlow();
b2xIdentityUserFlow.id = "UserFlowWithAPIConnector";
b2xIdentityUserFlow.userFlowType = UserFlowType.SIGN_UP_OR_SIGN_IN;
b2xIdentityUserFlow.userFlowTypeVersion = 1;
UserFlowApiConnectorConfiguration apiConnectorConfiguration = new UserFlowApiConnectorConfiguration();
IdentityApiConnector postFederationSignup = new IdentityApiConnector();
postFederationSignup.additionalDataManager().put("@odata.id", new JsonPrimitive("https://graph.microsoft.com/v1/identity/apiConnectors/{id}"));
apiConnectorConfiguration.postFederationSignup = postFederationSignup;
IdentityApiConnector postAttributeCollection = new IdentityApiConnector();
postAttributeCollection.additionalDataManager().put("@odata.id", new JsonPrimitive("https://graph.microsoft.com/v1/identity/apiConnectors/{id}"));
apiConnectorConfiguration.postAttributeCollection = postAttributeCollection;
b2xIdentityUserFlow.apiConnectorConfiguration = apiConnectorConfiguration;
graphClient.identity().b2xUserFlows()
.buildRequest()
.post(b2xIdentityUserFlow);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewB2xIdentityUserFlow()
id := "UserFlowWithAPIConnector"
requestBody.SetId(&id)
userFlowType := graphmodels.SIGNUPORSIGNIN_USERFLOWTYPE
requestBody.SetUserFlowType(&userFlowType)
userFlowTypeVersion := float32(1)
requestBody.SetUserFlowTypeVersion(&userFlowTypeVersion)
apiConnectorConfiguration := graphmodels.NewUserFlowApiConnectorConfiguration()
postFederationSignup := graphmodels.NewIdentityApiConnector()
additionalData := map[string]interface{}{
"odataId" : "https://graph.microsoft.com/v1/identity/apiConnectors/{id}",
}
postFederationSignup.SetAdditionalData(additionalData)
apiConnectorConfiguration.SetPostFederationSignup(postFederationSignup)
postAttributeCollection := graphmodels.NewIdentityApiConnector()
additionalData := map[string]interface{}{
"odataId" : "https://graph.microsoft.com/v1/identity/apiConnectors/{id}",
}
postAttributeCollection.SetAdditionalData(additionalData)
apiConnectorConfiguration.SetPostAttributeCollection(postAttributeCollection)
requestBody.SetApiConnectorConfiguration(apiConnectorConfiguration)
result, err := graphClient.Identity().B2xUserFlows().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new B2xIdentityUserFlow();
$requestBody->setId('UserFlowWithAPIConnector');
$requestBody->setUserFlowType(new UserFlowType('signuporsignin'));
$requestBody->setUserFlowTypeVersion(1);
$apiConnectorConfiguration = new UserFlowApiConnectorConfiguration();
$apiConnectorConfigurationPostFederationSignup = new IdentityApiConnector();
$additionalData = [
'@odata.id' => 'https://graph.microsoft.com/v1/identity/apiConnectors/{id}',
];
$apiConnectorConfigurationPostFederationSignup->setAdditionalData($additionalData);
$apiConnectorConfiguration->setPostFederationSignup($apiConnectorConfigurationPostFederationSignup);
$apiConnectorConfigurationPostAttributeCollection = new IdentityApiConnector();
$additionalData = [
'@odata.id' => 'https://graph.microsoft.com/v1/identity/apiConnectors/{id}',
];
$apiConnectorConfigurationPostAttributeCollection->setAdditionalData($additionalData);
$apiConnectorConfiguration->setPostAttributeCollection($apiConnectorConfigurationPostAttributeCollection);
$requestBody->setApiConnectorConfiguration($apiConnectorConfiguration);
$requestResult = $graphServiceClient->identity()->b2xUserFlows()->post($requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following is an example of the response.
Note: The response object shown here might be shortened for readability.
Note: The apiConnectorConfiguration
property always returns a '{}' value. To see full value with the navigation properties, use this API.
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/identity/b2xUserFlows/B2X_1_Partner
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#identity/b2xUserFlows/$entity",
"id": "B2X_1_UserFlowWithAPIConnector",
"userFlowType": "signUpOrSignIn",
"userFlowTypeVersion": 1,
"apiConnectorConfiguration": {}
}