Skip to content

Commit

Permalink
ME SSO
Browse files Browse the repository at this point in the history
  • Loading branch information
Yitong Feng committed Mar 10, 2021
1 parent efe6672 commit 267113c
Show file tree
Hide file tree
Showing 14 changed files with 4,914 additions and 0 deletions.
4 changes: 4 additions & 0 deletions samples/msgext-search-sso-config/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MicrosoftAppId=d9dd7f95-ce59-4c16-abf2-378569eee647
MicrosoftAppPassword=81n5x5.lGyE1p_OKN5oJt2F4__w_32FNqz
connectionName=YifeBotConnect
SiteUrl=https://497b94975bbe.ngrok.io
66 changes: 66 additions & 0 deletions samples/msgext-search-sso-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Teams Search Auth Config Bot

Bot Framework v4 sample for Teams expands the [50.teams-messaging-extensions-search](https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/50.teams-messaging-extensions-search) sample to include a configuration page and Bot Service authentication.

This bot has been created using [Bot Framework](https://dev.botframework.com), it shows how to use a Messaging Extension configuration page, as well as how to sign in from a search Messaging Extension.

## Prerequisites

- Microsoft Teams is installed and you have an account
- [NodeJS](https://nodejs.org/en/)
- [ngrok](https://ngrok.com/) or equivalent tunnelling solution

## To try this sample

> Note these instructions are for running the sample on your local machine, the tunnelling solution is required because
the Teams service needs to call into the bot.

1) Clone the repository

```bash
git clone https://github.com/Microsoft/botbuilder-samples.git
```

1) In a terminal, navigate to `samples/javascript_nodejs/52.teams-messaging-extensions-search-auth-config`

1) Install modules

```bash
npm install
```

1) Run ngrok - point to port 3978

```bash
ngrok http -host-header=rewrite 3978
```

1) Create [Bot Framework registration resource](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-quickstart-registration) in Azure
- Use the current `https` URL you were given by running ngrok. Append with the path `/api/messages` used by this sample
- Ensure that you've [enabled the Teams Channel](https://docs.microsoft.com/en-us/azure/bot-service/channel-connect-teams?view=azure-bot-service-4.0)
- __*If you don't have an Azure account*__ you can use this [Bot Framework registration](https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/create-a-bot-for-teams#register-your-web-service-with-the-bot-framework)

1) Update the `.env` configuration for the bot to use the Microsoft App Id and App Password from the Bot Framework registration. (Note the App Password is referred to as the "client secret" in the azure portal and you can always create a new client secret anytime.)

1) __*This step is specific to Teams.*__
- **Edit** the `manifest.json` contained in the `teamsAppManifest` folder to replace your Microsoft App Id (that was created when you registered your bot earlier) *everywhere* you see the place holder string `<<YOUR-MICROSOFT-APP-ID>>` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`)
- **Zip** up the contents of the `teamsAppManifest` folder to create a `manifest.zip`
- **Upload** the `manifest.zip` to Teams (in the Apps view click "Upload a custom app")
1) Run your bot at the command line:
```bash
npm start
```
## Interacting with the bot in Teams
Once the Messaging Extension is installed, click the icon for **Config Auth Search** in the Compose Box's Messaging Extension menu to display the search window. Right click to choose **Settings** and view the Config page.
## Deploy the bot to Azure
To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](https://aka.ms/azuredeployment) for a complete list of deployment instructions.
## Further reading
- [How Microsoft Teams bots work](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-basics-teams?view=azure-bot-service-4.0&tabs=javascript)
Loading

0 comments on commit 267113c

Please sign in to comment.