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
- In a terminal, navigate to `sp-dev-fx-extensions`
70
70
71
71
```bash
72
-
cd [Placeholder]
72
+
cd sp-dev-fx-extensions
73
+
```
74
+
75
+
- Navigate to the folder containing this sample
76
+
77
+
```bash
78
+
cd samples
79
+
cd react-bot-framework-secure
73
80
```
74
81
75
82
### [Setup bot](./bot/README.md)
76
83
84
+
- Go to `./bot`
85
+
77
86
- Install modules
78
87
79
88
```bash
80
89
npm install
81
90
```
82
91
83
-
- Register Connections. You can get it done by [deploy your bot to Azure](https://aka.ms/azuredeployment). Save your bot service endpoint like: "https://YOUR_BOT.azurewebsites.net". Save your AAD Id as YOUR_APP_ID and secret as YOUR_APP_PSW.
92
+
- Register Connections. You can get it done by [deploy your bot to Azure](https://aka.ms/azuredeployment). Save your bot service endpoint like: "https://YOUR_BOT.azurewebsites.net". Save your AAD Id as `YOUR_APP_ID` and secret as `YOUR_APP_PSW`.
84
93
85
94
- [Connect to direct line](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-directline?view=azure-bot-service-4.0), copy one of the Secret Key values as YOUR_DIRECT_LINE_SECRET and store this for later usage. This is your ‘Direct Line Secret’.
86
95
@@ -96,28 +105,18 @@ Version|Date|Comments
96
105
97
106
### [Setup extension](./extension/README.md)
98
107
99
-
- Install modules
100
-
101
-
```bash
102
-
npm install
103
-
```
104
-
105
108
- Edit "BotFrameworkChatPopupApplicationChat.tsx" file to set your bot endpoint (`props.botEndpoint`) directly like `https://YOUR_BOT.azurewebsites.net`fortesting purpose (instead of setting itin the Tenant Wide Extensions list):
106
109
107
110
```ts
108
-
generateToken(props.botEndpoint, md5(userId)).then((token: string) => { //change props.botEndpoint to the endpoint directly if you want to test it
[CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) must be set on bot app service to enable SharePoint client to get resource from bot service. Follow these steps to add your workbench to bot app service CORS configration:
117
116
118
117
1. Go to your azure portal
119
-
1. Navigate to your bot app service, search for CORS settings
120
-
1. Add https://localhost:4321 and https://<YOUR_SITE>.sharepoint.com to CORS origins
118
+
2. Navigate to your bot app service, search for CORS settings
119
+
3. Add https://localhost:4321 and https://<YOUR_SITE>.sharepoint.com to CORS origins
Copy file name to clipboardExpand all lines: samples/react-bot-framework-secure/extension/README.md
+3-5Lines changed: 3 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -31,11 +31,7 @@ An extension sample that uses the [botframework-webchat module](https://www.npmj
31
31
- Edit "BotFrameworkChatPopupApplicationChat.tsx" file to set your bot endpoint (`props.botEndpoint`) directly like `https://YOUR_BOT.azurewebsites.net` for testing purpose (instead of setting it in the Tenant Wide Extensions list):
32
32
33
33
```ts
34
-
generateToken(props.botEndpoint, md5(userId)).then((token:string) => { //change props.botEndpoint to the endpoint directly if you want to test it
- In a terminal, navigate to `sp-dev-fx-extensions`
77
77
78
-
This part is the same as [the extension web chat sample](Placeholder).
78
+
```bash
79
+
cd sp-dev-fx-extensions
80
+
```
79
81
80
-
- In a terminal, navigate to `[Placeholder]`
82
+
- Navigate to the folder containing this sample
81
83
82
84
```bash
83
-
cd [Placeholder]
85
+
cd samples
86
+
cd react-bot-framework-sso
84
87
```
85
88
89
+
### [Setup bot with Direct Line](./bot/README.md)
90
+
91
+
- Go to `./bot`
92
+
86
93
- Install modules
87
94
88
95
```bash
89
96
npm install
90
97
```
91
98
92
-
- Register connections. You can get it done by [deploy your bot to Azure](https://aka.ms/azuredeployment). Save your bot service endpoint like: "https://YOUR_BOT.azurewebsites.net". Save your AAD Id as YOUR_APP_ID, AAD Name as YOUR_APP_Name and secret as YOUR_APP_PSW.
99
+
- Register connections. You can get it done by [deploy your bot to Azure](https://aka.ms/azuredeployment). Save your bot service endpoint like: "https://YOUR_BOT.azurewebsites.net". Save your AAD Id as `YOUR_APP_ID`, AAD Name as `YOUR_APP_Name` and secret as `YOUR_APP_PSW`.
93
100
94
-
- [Connect to direct line](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-directline?view=azure-bot-service-4.0), copy one of the Secret Key values as YOUR_DIRECT_LINE_SECRET and store this for later. This is your ‘Direct Line Secret’.
101
+
- [Connect to direct line](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-directline?view=azure-bot-service-4.0), copy one of the Secret Key values as `YOUR_DIRECT_LINE_SECRET` and store this for later. This is your `Direct Line Secret`.
95
102
96
-
- Add ‘Direct Line Secret’ to an .env config file under ./bot
103
+
- Add `Direct Line Secret` to an .env config file under ./bot
97
104
98
105
```bash
99
106
MicrosoftAppId=YOUR_APP_ID
@@ -110,7 +117,7 @@ application setup for use in Azure Bot Service.
110
117
- Open your bot's application registration
111
118
- Save the tenant ID
112
119
- Select the "Overview" blade
113
-
- On the main pane, copy the content of "Directory (tenant) ID" as YOUR_APP_TENANT and store this for later
120
+
- On the main pane, copy the content of "Directory (tenant) ID" as `YOUR_APP_TENANT` and store this for later
114
121
- Update Authentication
115
122
- Select the "Authentication" blade
116
123
- Click "Add a platform" to add web if Web is not added
@@ -122,7 +129,7 @@ application setup for use in Azure Bot Service.
122
129
- Select the "Expose an API" blade
123
130
- Click the "Add a scope" button under "Scopes defined by this API"
124
131
- Click "Save and continue"
125
-
- Add a scope named YOUR_AAD_SCOPE_NAME
132
+
- Add a scope named `YOUR_AAD_SCOPE_NAME`
126
133
- Set "Who can consent?" to "Admins and users"
127
134
- Add an admin consent display name
128
135
- Add an admin consent description
@@ -131,7 +138,7 @@ application setup for use in Azure Bot Service.
- Click "API Permissions", select"Add a permission"
134
-
- Select "My APIs", YOUR_APP_ID, and enable YOUR_AAD_SCOPE_NAME scope \
141
+
- Select "My APIs", `YOUR_APP_ID`, and enable `YOUR_AAD_SCOPE_NAME` scope \
135
142
Otherwise the non-admin user cannot use SSO.
136
143
137
144
### Setup Authentication via Azure Bot Services for the Bot
@@ -192,10 +199,19 @@ application setup for use in Azure Bot Service.
192
199
],
193
200
```
194
201
195
-
- [Publish and host webpart](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/hosting-webpart-from-office-365-cdn), prepare for approving permissions
202
+
- Install modules
203
+
204
+
```bash
205
+
cd ../extension
206
+
npm install
207
+
```
208
+
209
+
- [Publish and host extension](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/hosting-extension-from-office365-cdn), prepare for approving permissions
196
210
197
211
- Refer [Connect to Azure AD-secured APIs](https://docs.microsoft.com/en-us/sharepoint/api-access) to publish and approve permissions from admin site
198
-
- Go to sharepoint admin center
212
+
- Please ensure your service principal had been enabled for your AAD account.
213
+
- Check "Managed application in local directory" in your AAD overview blade in Azure Portal
214
+
- Go to SharePoint admin center
199
215
- Find "API Access", approve "<YOUR_APP_Name>"
200
216
201
217
- (Opt. for hosted bot service) Config CORS \
@@ -204,22 +220,6 @@ application setup for use in Azure Bot Service.
204
220
2. Navigate to your bot app service, search for CORS settings
205
221
3. Add https://localhost:4321 and https://<YOUR_SITE>.sharepoint.com to CORS origins
206
222
207
-
- In the command line run
208
-
209
-
```bash
210
-
cd ../extension
211
-
npm install
212
-
gulp serve --nobrowser
213
-
```
214
-
215
-
- Open up a SharePoint modern page and add the following string to your URL:
Note: The first time users try SSO, users may be presented with an OAuth card to log in. This is because users have not yet given consent to the bot's Azure AD app. To avoid this, users can grant admin consent for any graph permissions requested by the Azure AD app.
337
352
338
-
Note: due to a SDK bug [here](https://github.com/microsoft/botbuilder-js/issues/3006), the consent card could not be shown properly yet. Granting admin consent may be necessary to workaround this.
353
+
Note: due to a [SDK bug](https://github.com/microsoft/botbuilder-js/issues/3006), the consent card could not be shown properly yet. Granting admin consent may be necessary to workaround this.
0 commit comments