@@ -9,7 +9,7 @@ manager: CelesteDG
9
9
ms.service : active-directory
10
10
11
11
ms.topic : reference
12
- ms.date : 01/11 /2024
12
+ ms.date : 05/07 /2024
13
13
ms.author : kengaderdus
14
14
ms.subservice : B2C
15
15
@@ -73,6 +73,43 @@ The following example shows a technical profile for `ReturnOAuth2Error`:
73
73
</ClaimsProviders> -->
74
74
```
75
75
76
+ ## Define claims transformation to generate custom values of error code and error message
77
+
78
+ Use these steps to generate custom values of error code and error message:
79
+
80
+ 1 . Locate the ` ClaimsTransformations ` element, then add the following code inside it
81
+
82
+ ``` xml
83
+ <!--
84
+ <ClaimsTransformations> -->
85
+ <ClaimsTransformation Id =" GenerateErrorCode" TransformationMethod =" CreateStringClaim" >
86
+ <InputParameters >
87
+ <InputParameter Id =" value" DataType =" string" Value =" Error_001" />
88
+ </InputParameters >
89
+ <OutputClaims >
90
+ <OutputClaim ClaimTypeReferenceId =" errorCode" TransformationClaimType =" createdClaim" />
91
+ </OutputClaims >
92
+ </ClaimsTransformation >
93
+ <ClaimsTransformation Id =" GenerateErrorMessage" TransformationMethod =" CreateStringClaim" >
94
+ <InputParameters >
95
+ <InputParameter Id =" value" DataType =" string" Value =" Insert error description." />
96
+ </InputParameters >
97
+ <OutputClaims >
98
+ <OutputClaim ClaimTypeReferenceId =" errorMessage" TransformationClaimType =" createdClaim" />
99
+ </OutputClaims >
100
+ </ClaimsTransformation >
101
+ <!--
102
+ </ClaimsTransformations> -->
103
+ ```
104
+
105
+ 1. Add the two claims transformations in the `OutputClaimsTransformations` element of any technical profile before Oauth2 technical that you define:
106
+
107
+ ```xml
108
+ <OutputClaimsTransformations >
109
+ <OutputClaimsTransformation ReferenceId =" generateErrorCode" />
110
+ <OutputClaimsTransformation ReferenceId =" generateErrorMessage" />
111
+ </OutputClaimsTransformations >
112
+ ```
76
113
## Input claims
77
114
78
115
The **InputClaims** element contains a list of claims required to return OAuth2 error.
@@ -123,6 +160,20 @@ In the following example:
123
160
</UserJourney >
124
161
```
125
162
163
+ Optionally, you can use preconditions to manipulate the Oauth2 error technical profile. For example, if there is no email claim, you can set to call Oauth2 error technical profile:
164
+
165
+ ``` xml
166
+ <OrchestrationStep Order =" 3" Type =" SendClaims" CpimIssuerTechnicalProfileReferenceId =" ReturnOAuth2Error" >
167
+ <Preconditions >
168
+ <Precondition Type =" ClaimsExist" ExecuteActionsIf =" false" >
169
+ <Value >email</Value >
170
+ <Action >SkipThisOrchestrationStep</Action >
171
+ </Precondition >
172
+ </Preconditions >
173
+ </OrchestrationStep >
174
+ ```
175
+
176
+
126
177
## Next steps
127
178
128
179
Learn about [ UserJourneys] ( userjourneys.md )
0 commit comments