Azure-Samples / azure-search-openai-demo

A sample app for the Retrieval-Augmented Generation pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences.
https://azure.microsoft.com/products/search
MIT License
5.57k stars 3.74k forks source link

Error with "Login" button #1697

Closed biancat821 closed 1 week ago

biancat821 commented 2 weeks ago

This issue is for a:

- [ X ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Enable the authetication as described in https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/docs/login_and_acl.md#automatic-setup

The optional steps 3, 4 and 5 for ACL were skipped.

Any log messages given by the failure

AADSTS900144: The request body must contain the following parameter: 'client_id'.

Screenshot (1095)

Expected/desired behavior

The system allowed the user to login

OS and Version?

Windows 11

azd version?

azd version 1.8.1 (commit 88369c36ce2a0d60794389aad9b10de938f587e1)

pamelafox commented 2 weeks ago

Hm, I wonder if the environment variables aren't set correctly. Can you check AZURE_CLIENT_APP_ID and AZURE_SERVER_APP_ID on your deployed App Service app and confirm they match the application registrations? Are you seeing this error on local dev server or deployed app?

mattgotteiner commented 2 weeks ago

Can you also please check the app in the portal that was setup and tell us what platforms are configured?

https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app#configure-platform-settings

evan2k commented 2 weeks ago

same issue here. Neither AZURE_CLIENT_APP_ID nor AZURE_SERVER_APP_ID were setup in either dev or deployed. I thought azd up should have filled those up when authorization is enabled. Right? Thanks.

biancat821 commented 2 weeks ago

First of all, thank you Pamela and Matt. As Evan, that is having my same issue, I do not have the AZURE_CLIENT_APP_ID nor AZURE_SERVER_APP_ID setup in. Moreover I also checked the app in the portal following the instructions in the link provided by Matt. I have the following configuration

Screenshot (1111)

Copying and pasting the link provided in the screenshot above I am returned with the following message.

Screenshot (1110)

However, when I enter the chat-app and I press the "Login" button, I am returned with the same error.

biancat821 commented 1 week ago

We finally managed to solve the issue. Actually in the area Registrations App of Azure we did not have the:

The problem was due to the fact that, when launching the command

azd up

the two applications mentioned above were not created.

This was caused by an error due to long path not enabled.

Therefore our solution was:

  1. Enable the long path in Windows (e.g. following instructions in Make Windows accept File Paths over 260 characters (thewindowsclub.com))
  2. Adding in the .env file the environmental variable AZURE_TENANT_ID that was set equal to AZURE_AUTH_TENANT_ID
  3. Running the script auth_init.ps1 with the command

pwsh .\scripts\auth_init.ps1

  1. At this point the two apps mentioned above appeared in the area Registrations App of Azure.
  2. Finally we launched the command

azd up

  1. It took a while to have the chat app running again (at least 1 hour), so be patient after point 5.