You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/active-directory-b2c/access-tokens.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,7 @@ grant_type=authorization_code
106
106
&client_secret=2hMG2-_:y12n10vwH...
107
107
```
108
108
109
-
If you want to test this POST HTTP request, you can use any HTTP client such as [Microsoft PowerShell](/powershell/scripting/overview) or [Postman](https://www.postman.com/).
109
+
If you want to test this POST HTTP request, you can use any HTTP client such as [Microsoft PowerShell](/powershell/scripting/overview).
Copy file name to clipboardExpand all lines: articles/active-directory-b2c/authorization-code-flow.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,7 @@ error=access_denied
106
106
| state |See the full description in the preceding table. If a `state` parameter is included in the request, the same value should appear in the response. The app should verify that the `state` values in the request and response are identical. |
107
107
108
108
## 2. Get an access token
109
-
Now that you've acquired an authorization code, you can redeem the `code` for a token to the intended resource by sending a POST request to the `/token` endpoint. In Azure AD B2C, you can [request access tokens for other API's](access-tokens.md#request-a-token) as usual by specifying their scope(s) in the request.
109
+
Now that you've acquired an authorization code, you can redeem the `code` for a token to the intended resource by sending a POST request to the `/token` endpoint. In Azure AD B2C, you can [request access tokens for other APIs](access-tokens.md#request-a-token) as usual by specifying their scope(s) in the request.
110
110
111
111
You can also request an access token for your app's own back-end Web API by convention of using the app's client ID as the requested scope (which will result in an access token with that client ID as the "audience"):
112
112
@@ -135,7 +135,7 @@ grant_type=authorization_code
135
135
| redirect_uri |Required |The redirect URI of the application where you received the authorization code. |
136
136
| code_verifier | recommended | The same `code_verifier` used to obtain the authorization code. Required if PKCE was used in the authorization code grant request. For more information, see the [PKCE RFC](https://tools.ietf.org/html/rfc7636). |
137
137
138
-
If you're testing this POST HTTP request, you can use any HTTP client such as [Microsoft PowerShell](/powershell/scripting/overview) or [Postman](https://www.postman.com/).
138
+
If you're testing this POST HTTP request, you can use any HTTP client such as [Microsoft PowerShell](/powershell/scripting/overview).
Copy file name to clipboardExpand all lines: articles/active-directory-b2c/custom-policies-series-call-rest-api.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -108,7 +108,7 @@ You need to deploy an app, which serves as your external app. Your custom policy
108
108
109
109
1. To test the app works as expected, use the following steps:
110
110
1. In your terminal, run the `node index.js` command to start your app server.
111
-
1. To make a POST request similar to the one shown inthis example, you can use an HTTP client such as [Microsoft PowerShell](/powershell/scripting/overview) or [Postman](https://www.postman.com/):
111
+
1. To make a POST request similar to the one shown inthis example, you can use an HTTP client such as [Microsoft PowerShell](/powershell/scripting/overview).
112
112
113
113
```http
114
114
POST http://localhost/validate-accesscode HTTP/1.1
@@ -147,15 +147,15 @@ At this point, you're ready to deploy your Node.js app.
147
147
148
148
### Step 1.2- Deploy the Node.js app in Azure App Service
149
149
150
-
For your custom policy to reach your Node.js app, it needs to be reachable, so, you need deploy it. Inthis article, you deploy the app by using [Azure App Service](../app-service/overview-vnet-integration.md), but you use an alternative hosting approach.
150
+
For your custom policy to reach your Node.js app, it needs to be reachable, so, you need to deploy it. Inthis article, you deploy the app by using [Azure App Service](../app-service/overview-vnet-integration.md), but you use an alternative hosting approach.
151
151
152
152
Follow the steps in [Deploy your app to Azure](../app-service/quickstart-nodejs.md#deploy-to-azure) to deploy your Node.js app to Azure. For the **Name**of the app, use a descriptive name such as `custompolicyapi`. Hence:
153
153
154
154
- App URL looks similar to `https://custompolicyapi.azurewebsites.net`.
155
155
156
156
- Service endpoint looks similar to `https://custompolicyapi.azurewebsites.net/validate-accesscode`.
157
157
158
-
You can test the app you've deployed by using an HTTP client such as [Microsoft PowerShell](/powershell/scripting/overview) or [Postman](https://www.postman.com/). This time, use `https://custompolicyapi.azurewebsites.net/validate-accesscode` URL as the endpoint.
158
+
You can test the app you've deployed by using an HTTP client such as [Microsoft PowerShell](/powershell/scripting/overview). This time, use `https://custompolicyapi.azurewebsites.net/validate-accesscode` URL as the endpoint.
Copy file name to clipboardExpand all lines: articles/active-directory-b2c/secure-api-management.md
-103Lines changed: 0 additions & 103 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,6 @@ Before you begin, make sure that you have the following resources in place:
29
29
* An [application that's registered in your tenant](tutorial-register-applications.md)
30
30
*[User flows that are created in your tenant](tutorial-create-user-flows.md)
31
31
* A [published API](../api-management/import-and-publish.md) in Azure API Management
32
-
* (Optional) A [Postman platform](https://www.postman.com/) to test secured access
33
32
34
33
## Get Azure AD B2C application ID
35
34
@@ -114,108 +113,6 @@ You're now ready to add the inbound policy in Azure API Management that validate
114
113
<on-error> <base /> </on-error>
115
114
</policies>
116
115
```
117
-
118
-
## Validate secure API access
119
-
120
-
To ensure that only authenticated callers can access your API, you can validate your Azure API Management configuration by calling the API with [Postman](https://www.postman.com/).
121
-
122
-
To call the API, you need both an access token that's issued by Azure AD B2C and an Azure API Management subscription key.
123
-
124
-
### Get an access token
125
-
126
-
You first need a token that's issued by Azure AD B2C to use in the `Authorization` header in Postman. You can get one by using the *Run now* feature of the sign-up/sign-in user flow you that you created as one of the prerequisites.
127
-
128
-
1. In the [Azure portal](https://portal.azure.com), go to your Azure AD B2C tenant.
129
-
1. Under **Policies**, select **User flows**.
130
-
1. Select an existing sign-up/sign-in user flow (for example, *B2C_1_signupsignin1*).
131
-
1. For **Application**, select *webapp1*.
132
-
1. For **Reply URL**, select `https://jwt.ms`.
133
-
1. Select **Run user flow**.
134
-
135
-

136
-
137
-
1. Complete the sign-in process. You should be redirected to `https://jwt.ms`.
138
-
1. Record the encoded token value that's displayed in your browser. You use this token value for the Authorization header in Postman.
139
-
140
-

141
-
142
-
### Get an API subscription key
143
-
144
-
A client application (in this case, Postman) that calls a published API must include a valid API Management subscription key in its HTTP requests to the API. To get a subscription key to include in your Postman HTTP request:
145
-
146
-
1. In the [Azure portal](https://portal.azure.com), go to your Azure API Management service instance.
147
-
1. Select **Subscriptions**.
148
-
1. Select the ellipsis (**...**) next to **Product: Unlimited**, and then select **Show/hide keys**.
149
-
1. Record the **Primary Key** for the product. You use this key for the `Ocp-Apim-Subscription-Key` header in your HTTP request in Postman.
150
-
151
-

152
-
153
-
### Test a secure API call
154
-
155
-
With the access token and Azure API Management subscription key recorded, you're now ready to test whether you've correctly configured secure access to the API.
156
-
157
-
1. Create a new `GET` request in [Postman](https://www.postman.com/). For the request URL, specify the speakers list endpoint of the API you published as one of the prerequisites. For example:
| `Authorization` | The encoded token value you recorded earlier, prefixed with `Bearer ` (include the space after "Bearer") |
166
-
| `Ocp-Apim-Subscription-Key` | The Azure API Management subscription key you recorded earlier. |
167
-
| | |
168
-
169
-
Your **GET** request URL and **Headers** should appear similar to those shown in the following image:
170
-
171
-

172
-
173
-
1. In Postman, select the **Send** button to execute the request. If you've configured everything correctly, you should be given a JSON response with a collection of conference speakers (shown here, truncated):
Now that you've made a successful request, test the failure case to ensure that calls to your API with an *invalid* token are rejected as expected. One way to perform the test is to add or change a few characters in the token value, and then run the same `GET` request as before.
203
-
204
-
1. Add several characters to the token value to simulate an invalid token. For example, you could add "INVALID" to the token value, as shown here:
205
-
206
-

207
-
208
-
1. Select the **Send** button to execute the request. With an invalid token, the expected result is a `401` unauthorized status code:
209
-
210
-
```json
211
-
{
212
-
"statusCode": 401,
213
-
"message": "Unauthorized. Access token is missing or invalid."
214
-
}
215
-
```
216
-
217
-
If you see a `401` status code, you've verified that only callers with a valid access token issued by Azure AD B2C can make successful requests to your Azure API Management API.
218
-
219
116
## Support multiple applications and issuers
220
117
221
118
Several applications typically interact with a single REST API. To enable your API to accept tokens intended for multiple applications, add their application IDs to the `<audiences>` element in the Azure API Management inbound policy.
0 commit comments