OfficeDev / teams-toolkit

Developer tools for building Teams apps
Other
451 stars 177 forks source link

Always getting unathorised error in ngrok command prompt #9274

Open pschandekar09 opened 1 year ago

pschandekar09 commented 1 year ago

Always getting unauthorized error in ngrok command prompt for team bot which is created using teamtoolbox. If any one facing similar issue and got the solution I appreciate if they help me on this issue as well. image

ghost commented 1 year ago

Thank you for contacting us! Any issue or feedback from you is quite important to us. We will do our best to fully respond to your issue as soon as possible. Sometimes additional investigations may be needed, we will usually get back to you within 2 days by adding comments to this issue. Please stay tuned.

XiaofuHuang commented 1 year ago

In Teams Toolkit V5, the default tunnel service is now the dev tunnel. To take advantage of this, you can upgrade your Teams Toolkit extension to V5.

If yo still want to use Teams Tolkit V4:

  1. If you only want to setup ngrok auth token, follow these steps:
    1. Sign up for an ngrok account by visiting https://dashboard.ngrok.com/signup.
    2. Once you have signed up, go to https://dashboard.ngrok.com/get-started/your-authtoken to access your personal ngrok authtoken. Copy it.
    3. Run the following command to set the ngrok authentication token:
      ~/.fx/bin/ngrok/node_modules/ngrok/bin/ngrok authtoken <YOUR AUTHTOKEN>
  2. If you prefer to start your local tunnel service manually, you can follow these steps to use the dev tunnel CLI:
    1. Install dev tunnel cli.
    2. Login with your M365 Account using the command devtunnel user login.
    3. Start your local tunnel service by running the command devtunnel host -p 3978 --protocol http --allow-anonymous.
    4. Fill in the values for BOT_DOMAIN and BOT_ENDPOINT with your dev tunnel URL.
      • For the project created in Teams Toolkit V5, fill the values in the env/.env.local file.
        BOT_DOMAIN=sample-id-3978.devtunnels.ms
        BOT_ENDPOINT=https://sample-id-3978.devtunnels.ms
      • For the project created in Teams Toolkit V4, you can set botMessagingEndpoint arguments in Set up bot task.
        {
          "label": "Set up bot",
          "type": "teamsfx",
          "command": "debug-set-up-bot",
          "args": {
              ...
              // tell Teams Toolkit your message endpoint
              "botMessagingEndpoint": "https://sample-id.ngrok.io/api/messages",
          }
        },
  3. If you're using the ngrok task in Teams Toolkit V4, please refer to this link for guidance on resolving any related issues.
pschandekar09 commented 1 year ago

Do I need to follow same above steps for bot framework application as well for unauthorized and 401 error?

pschandekar09 commented 1 year ago

One more question which one is best option shall I implement bot framework or bot team toolbox application. My expectation is that implemented application should support multiple channels.

XiaofuHuang commented 1 year ago

Do I need to follow same above steps for bot framework application as well for unauthorized and 401 error?

The steps mentioned above can resolve the unauthorized error when using Teams Toolkit with ngrok.

One more question which one is best option shall I implement bot framework or bot team toolbox application. My expectation is that implemented application should support multiple channels.

We recommend using the Teams Toolkit to develop the app for Teams. However, for other channels, manual integration is required.