Skip to content

Commit 3e9fc0d

Browse files
committed
scope check
1 parent fbb2947 commit 3e9fc0d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ To see how to call this web API from a client application, refer to this [B2C Si
2222
|-------------------|--------------------------------------------|
2323
| `process.json` | Contains configuration parameters for logging via Morgan. |
2424
| `index.js` | Main application logic resides here. |
25-
| `apiConfig.js` | Contains configuration parameters for the sample. |
25+
| `config.js` | Contains configuration parameters for the sample. |
2626
| `.gitignore` | Defines what to ignore at commit time. |
2727
| `CHANGELOG.md` | List of changes to the sample. |
2828
| `CODE_OF_CONDUCT.md` | Code of Conduct information. |
@@ -77,7 +77,7 @@ Follow the instructions at [register a Web API with Azure AD B2C](https://docs.m
7777

7878
#### Step 4: Configure your application source code
7979

80-
You can now fill in the variables in the `apiConfig.js` file of the Node.js Web API sample with the parameters you've obtained from the Azure Portal during the steps above.
80+
You can now fill in the variables in the `config.js` file of the Node.js Web API sample with the parameters you've obtained from the Azure Portal during the steps above.
8181

8282
Configure the following variables:
8383

File renamed without changes.

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const express = require("express");
22
const morgan = require("morgan");
33
const passport = require("passport");
4-
const config = require('./apiConfig');
4+
const config = require('./config');
55
const BearerStrategy = require('passport-azure-ad').BearerStrategy;
66

77
// A simple check for clientID placeholder
@@ -38,7 +38,7 @@ app.get("/hello",
3838
console.log('User info: ', req.user);
3939
console.log('Validated claims: ', req.authInfo);
4040

41-
if (req.authInfo['scp'].split(" ").indexOf("demo.read") >= 0) {
41+
if ('scp' in req.authInfo && req.authInfo['scp'].split(" ").indexOf("demo.read") >= 0) {
4242
// Service relies on the name claim.
4343
res.status(200).json({'name': req.authInfo['name']});
4444
} else {

0 commit comments

Comments
 (0)