Skip to content

Commit

Permalink
dev-tunnel changes (#918)
Browse files Browse the repository at this point in the history
* dev-tunnel changes

* Readme updates.

* dev tunnel changes

* Updating dev-tunnel changes and readme for all samples

* Fixed PR Comments

---------

Co-authored-by: Harikrishnan Rajandiran <v-hrajandira@microsoft.com>
  • Loading branch information
ChetanSharma-msft and Harikrishnan-MSFT authored Aug 30, 2023
1 parent bfa805b commit d166d01
Show file tree
Hide file tree
Showing 306 changed files with 2,965 additions and 1,538 deletions.
9 changes: 8 additions & 1 deletion samples/account-linking/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,20 @@ There are example in-memory and Azure implementations of the token persistance.
```bash
dotnet --version
```
- [ngrok](https://ngrok.com/download) (For local environment testing) Latest (any other tunneling software can also be used)

- [dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) or [ngrok](https://ngrok.com/download) (For local environment testing) latest version (any other tunneling software can also be used).

run ngrok locally
```bash
ngrok http 5001 --host-header="localhost:5001"
```

Alternatively, you can also use the `dev tunnels`. Please follow [Create and host a dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) and host the tunnel with anonymous user access command as shown below:

```bash
devtunnel host -p 5001 --allow-anonymous
```

## Setup
### 1. Getting the domain name
If you are running this app locally, you will probably be using some form of tunnel to your local machine. For this sample we use [ngrok](https://ngrok.com)
Expand Down
18 changes: 12 additions & 6 deletions samples/app-anonymous-users/csharp/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This sample shows anonymous users support in meeting apps.
```bash
dotnet --version
```
- [ngrok](https://ngrok.com/) or equivalent tunnelling solution
- [dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) or [ngrok](https://ngrok.com/) latest version or equivalent tunnelling solution.
- [Teams](https://teams.microsoft.com) Microsoft Teams is installed and you have an account

## Setup
Expand All @@ -39,9 +39,15 @@ This sample shows anonymous users support in meeting apps.
1. Run ngrok - point to port 3978

```bash
ngrok http 3978 --host-header="localhost:3978"
ngrok http 3978 --host-header="localhost:3978"
```

Alternatively, you can also use the `dev tunnels`. Please follow [Create and host a dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) and host the tunnel with anonymous user access command as shown below:

```bash
devtunnel host -p 3978 --allow-anonymous
```

2. Setup

### Register you app with Azure AD.
Expand Down Expand Up @@ -72,7 +78,7 @@ This sample shows anonymous users support in meeting apps.
* `5e3ce6c0-2b1f-4285-8d4b-75ee78787346` (Teams web application)
12. Navigate to **API Permissions**, and make sure to add the follow permissions:
- Select Add a permission
-  Select Microsoft Graph -\> Delegated permissions.
- Select Microsoft Graph -\> Delegated permissions.
- `User.Read` (enabled by default)
- Click on Add permissions. Please make sure to grant the admin consent for the required permissions.
13. Navigate to **Authentication**
Expand All @@ -86,7 +92,7 @@ This sample shows anonymous users support in meeting apps.
15. Create a Bot Registration
- Register a bot with Azure Bot Service, following the instructions [here](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-quickstart-registration?view=azure-bot-service-3.0).
- 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)
- While registering the bot, use `https://<your_ngrok_url>/api/messages` as the messaging endpoint.
- While registering the bot, use `https://<your_tunnel_domain>/api/messages` as the messaging endpoint.
16. To test facebook auth flow [create a facebookapp](FacebookAuth/README.md) and get client id and secret for facebook app.
Now go to your bot channel registartion -> configuration -> Add OAuth connection string
Expand Down Expand Up @@ -129,7 +135,7 @@ This sample shows anonymous users support in meeting apps.
- `{{Microsoft-App-id}}` - Generated from Step 1 (Application (client) ID)is the application app id
- `{{TenantId}}` - Generated from Step 1(Directory (tenant) ID) is the tenant id
- `{{MicrosoftAppPassword}}` - Generated from Step 1.14, also referred to as Client secret
- `{{domain-name}}` - Your application's base url. E.g. https://12345.ngrok-free.app if you are using ngrok.
- `{{domain-name}}` - Your application's base url. E.g. https://12345.ngrok-free.app if you are using ngrok and if you are using dev tunnels, your URL will be like: https://12345.devtunnels.ms.
- `{{FacebookAppId}} and {{FacebookAppPassword}}`- Generated from step 16.
7) Modify the .env file in your project folder (or in Visual Studio) and fill in below details:
Expand All @@ -140,7 +146,7 @@ This sample shows anonymous users support in meeting apps.
- **Edit** the `manifest.json` contained in the `TeamsAppManifest` folder to replace your Microsoft App Id `<<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`)
- **Edit** the `manifest.json` for `{{domain-name}}` with base Url domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app`.
- **Edit** the `manifest.json` for `{{domain-name}}` with base Url domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app` and if you are using dev tunnels then your domain will be like: `12345.devtunnels.ms`.
- **Zip** up the contents of the `TeamsAppManifest` folder to create a `manifest.zip` (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
Expand Down
16 changes: 11 additions & 5 deletions samples/app-anonymous-users/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This sample shows anonymous users support in Teams meeting apps.
# determine node version
node --version
```
- [ngrok](https://ngrok.com/) or equivalent tunnelling solution
- [dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) or [ngrok](https://ngrok.com/) latest version or equivalent tunnelling solution
- [Teams](https://teams.microsoft.com) Microsoft Teams is installed and you have an account
- [Teams Toolkit for VS Code](https://marketplace.visualstudio.com/items?itemName=TeamsDevApp.ms-teams-vscode-extension) or [TeamsFx CLI](https://learn.microsoft.com/microsoftteams/platform/toolkit/teamsfx-cli?pivots=version-one)

Expand All @@ -51,9 +51,15 @@ The simplest way to run this sample in Teams is to use Teams Toolkit for Visual
1. Run ngrok - point to port 3978

```bash
ngrok http --host-header=rewrite 3978
ngrok http 3978 --host-header="localhost:3978"
```

Alternatively, you can also use the `dev tunnels`. Please follow [Create and host a dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) and host the tunnel with anonymous user access command as shown below:

```bash
devtunnel host -p 3978 --allow-anonymous
```

2. Setup

### Register you app with Azure AD.
Expand Down Expand Up @@ -98,7 +104,7 @@ The simplest way to run this sample in Teams is to use Teams Toolkit for Visual
15. Create a Bot Registration
- Register a bot with Azure Bot Service, following the instructions [here](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-quickstart-registration?view=azure-bot-service-3.0).
- 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)
- While registering the bot, use `https://<your_ngrok_url>/api/messages` as the messaging endpoint.
- While registering the bot, use `https://<your_tunnel_domain>/api/messages` as the messaging endpoint.
16. To test facebook auth flow [create a facebookapp](FacebookAuth/README.md) and get client id and secret for facebook app.
Now go to your bot channel registartion -> configuration -> Add OAuth connection string
Expand All @@ -119,7 +125,7 @@ The simplest way to run this sample in Teams is to use Teams Toolkit for Visual
- `{{MicrosoftAppPassword}}` - Generated from Step 1.14, also referred to as Client secret
- `{{TenantId}}` - Generated from Step 1(Directory (tenant) ID) is the tenant id
- `{{FacebookAppId}} and {{FacebookAppPassword}}`- Generated from step 16.
- `{{domain-name}}` - Your application's base url. E.g. https://12345.ngrok-free.app if you are using ngrok.
- `{{domain-name}}` - Your domain name. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app` and if you are using dev tunnels then your domain will be like: `12345.devtunnels.ms`.
5. Open .env file from this path folder `samples/app-anonymous-users/nodejs/ClientApp` and update
- `{{Microsoft-App-id}}` - Generated from Step 1 (Application (client) ID)is the application app id
Expand Down Expand Up @@ -156,7 +162,7 @@ The simplest way to run this sample in Teams is to use Teams Toolkit for Visual
- **Edit** the `manifest.json` contained in the `TeamsAppManifest` folder to replace your Microsoft App Id `<<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`)
- **Edit** the `manifest.json` for `{{domain-name}}` with base Url domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app`.
- **Edit** the `manifest.json` for `{{domain-name}}` with base Url domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app` and if you are using dev tunnels then your domain will be like: `12345.devtunnels.ms`.
- **Zip** up the contents of the `TeamsAppManifest` folder to create a `manifest.zip` (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
Expand Down
20 changes: 13 additions & 7 deletions samples/app-auth/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ This sample demonstrates authentication in Microsoft Teams using bot and tab.

## Getting started

1. Install some sort of tunnelling service. These instructions assume you are using ngrok: https://ngrok.com/
1. Install some sort of tunnelling service. Eg. [dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) or [ngrok](https://ngrok.com/) latest version or equivalent tunnelling solution
2. Begin your tunnelling service to get an https endpoint. For this example ngrok is used. Start an ngrok tunnel with the following command (you'll need the https endpoint for the bot registration):<br>

```bash
ngrok http 3978 --host-header=localhost
```
Alternatively, you can also use the `dev tunnels`. Please follow this documentation: [Create and host a dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) link and host the tunnel with anonymous user access as shown below:

```bash
devtunnel host -p 3978 --allow-anonymous
```

### Setup for code

- Clone the repository
Expand All @@ -54,15 +60,15 @@ This sample demonstrates authentication in Microsoft Teams using bot and tab.

3. Register a bot with Azure Bot Service, following the instructions [here](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-quickstart-registration?view=azure-bot-service-3.0).
- 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)
- While registering the bot, use `https://<your_ngrok_url>/api/messages` as the messaging endpoint.
- While registering the bot, use `https://<your_tunnel_domain>/api/messages` as the messaging endpoint.
> NOTE: When you create your bot you will create an App ID and App password - make sure you keep these for later.
> **IMPORTANT**: Do not use the legacy Bot Framework portal, nor App Studio, to create the bot. Your bot MUST be registered with
> Azure Bot Service to use the authentication functionality provided by Azure Bot Service.
4. Create an app manifest. Navigate to the file, manifest/manifest.json - Change:
1. <<REGISTERED_BOT_ID>> (there are 3) change to your registered bot's app ID
2. <<BASE_URI_DOMAIN>> (there are 5) change to your https endpoint from ngrok excluding the "https://" part
2. <<BASE_URI_DOMAIN>> (there are 5) change to your https endpoint from tunnel excluding the "https://" part
**Note:** If you want to test your app across multi hub like: Outlook/Office.com, please update the `manifest.json` in the `app-auth\nodejs\Manifest_Hub` folder with the required values.
3. Zip up the contents of the `manifest` folder to create a `manifest.zip` or `Manifest_Hub` folder into a `Manifest_Hub.zip`. (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
Expand All @@ -87,13 +93,13 @@ Registering a bot with the Microsoft Bot Framework automatically creates a corre
2. Find your application in the list and click on the name to edit.
3. Navigate to **Authentication** under **Manage** and add the following redirect URLs:
- `https://<your_ngrok_url>/tab/simple-end`
- `https://<your_tunnel_domain>/tab/simple-end`
- `https://token.botframework.com/.auth/web/redirect`
- Add this URL as *Single-page application* `https://<your_ngrok_url>/tab/silent-end`
- Add this URL as *Single-page application* `https://<your_tunnel_domain>/tab/silent-end`
4. Additionally, under the **Implicit grant** subsection select **Access tokens** and **ID tokens**
5. Click on **Expose an API** under **Manage**. Select the Set link to generate the Application ID URI in the form of api://{AppID}. Insert your fully qualified domain name (with a forward slash "/" appended to the end) between the double forward slashes and the GUID. The entire ID should have the form of: api://<your_ngrok_url>/{AppID}
5. Click on **Expose an API** under **Manage**. Select the Set link to generate the Application ID URI in the form of api://{AppID}. Insert your fully qualified domain name (with a forward slash "/" appended to the end) between the double forward slashes and the GUID. The entire ID should have the form of: api://<your_tunnel_domain>/{AppID}
6. Select the **Add a scope** button. In the panel that opens, enter `access_as_user` as the **Scope name**.
7. Set Who can consent? to Admins and users
Expand All @@ -106,7 +112,7 @@ Registering a bot with the Microsoft Bot Framework automatically creates a corre
10. Select **Add scope**
- Note: The domain part of the **Scope name** displayed just below the text field should automatically match the **Application ID** URI set in the previous step, with `/access_as_user` appended to the end; for example:
- `api://<your_ngrok_url>/<aad_application_id>/access_as_user`
- `api://<your_tunnel_domain>/<aad_application_id>/access_as_user`
- If you are facing any issue in your app, please uncomment [this] line( https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/app-auth/nodejs/src/AuthBot.ts#L119) and put your debugger for local debug.
11. In the **Authorized client applications** section, you identify the applications that you want to authorize to your app’s web application. Each of the following IDs needs to be entered:
Expand Down
16 changes: 11 additions & 5 deletions samples/app-cache-meetings/nodejs/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This sample feature shows how to improve the subsequent loading time of an App t
## Prerequisites

- [NodeJS](https://nodejs.org/en/)
- [ngrok](https://ngrok.com/) or equivalent tunnelling solution
- [dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) or [ngrok](https://ngrok.com/) latest version or equivalent tunnelling solution
- [Teams Toolkit for VS Code](https://marketplace.visualstudio.com/items?itemName=TeamsDevApp.ms-teams-vscode-extension) or [TeamsFx CLI](https://learn.microsoft.com/microsoftteams/platform/toolkit/teamsfx-cli?pivots=version-one)

## Run the app (Using Teams Toolkit for Visual Studio Code)
Expand All @@ -45,9 +45,15 @@ The simplest way to run this sample in Teams is to use Teams Toolkit for Visual
1) Run ngrok - point to port 3978

```bash
ngrok http 3978 --host-header="localhost:3978"
```
```bash
ngrok http 3978 --host-header="localhost:3978"
```

Alternatively, you can also use the `dev tunnels`. Please follow [Create and host a dev tunnel](https://learn.microsoft.com/en-us/azure/developer/dev-tunnels/get-started?tabs=windows) and host the tunnel with anonymous user access command as shown below:

```bash
devtunnel host -p 3978 --allow-anonymous
```

2) Clone the repository

Expand Down Expand Up @@ -78,7 +84,7 @@ The simplest way to run this sample in Teams is to use Teams Toolkit for Visual

4) __*This step is specific to Teams.*__
- **Edit** the `manifest.json` contained in the `appPackage` folder to replace your `<<MANIFEST-ID>>`, You can use any GUID Id in place of `<<Manifest-ID>>` or [Generate Guid](https://guidgenerator.com/)
- **Edit** the `manifest.json` for `<<Valid_Domain>>` with base Url domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app`. Replace it at all the places in your manifest.json.
- **Edit** the `manifest.json` for `<<Valid_Domain>>` with base Url domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app` and if you are using dev tunnels then your domain will be like: `12345.devtunnels.ms`. Replace it at all the places in your manifest.json.
- **Zip** up the contents of the `appPackage` folder to create a `manifest.zip` (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
- **Upload** the `manifest.zip` to Teams (In Teams Apps/Manage your apps click "Upload an app". Browse to and Open the .zip file. At the next dialog, click the Add button.)
- Sideload the app In meetings (Supported scopes)
Expand Down
Loading

0 comments on commit d166d01

Please sign in to comment.