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
6.34k stars 4.23k forks source link

Enable Local Deployment with Login/ACLs and Uploads On #1899

Closed rtvu closed 3 months ago

rtvu commented 3 months ago

Please provide us with the following information:

With local deployment, I can access the application as an unauthenticated user. However, when I try to login in, I get an error.

How would I configure the application to allow me to authenticate while deploying locally.

This issue is for a: (mark with an x)

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

Minimal steps to reproduce

  1. Configure environment for Login/ACLs and Uploads according to the docs.
  2. Run azd up
  3. Verify login works from Azure Web App Service
  4. Start local backend ./app/start.sh.
  5. Try logging in with local deployment

Any log messages given by the failure

AADSTS50011: The redirect URI 'http://127.0.0.1:50505/redirect' specified in the request does not match the redirect URIs configured for the application '33ca7bc5-6a02-463a-a650-1d74a1a6ab17'. Make sure the redirect URI sent in the request matches one added to your application in the Azure portal. Navigate to https://aka.ms/redirectUriMismatchError to learn more about how to fix this.

Expected/desired behavior

Can log into application with local deployment. Necessary to working on frontend changes.

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Mac Sonoma, Running latest VSCode and Devcontainers

azd version?

run azd version and copy paste here.

azd version 1.9.5 (commit cd2b7af9995d358aab33c782614f801ac1997dde)

Versions

Repo at commit: 55b0961b98bf22b44fc6fd45c9ef0fc583c14f6e

Mention any other details that might be useful


Thanks! We'll be in touch soon.

pamelafox commented 3 months ago

You need to use localhost, versus 127.0.0.1, as that's what we configure the app registrations for: https://github.com/Azure-Samples/azure-search-openai-demo/blob/main/scripts/auth_update.py#L36

Unfortunately, Entra doesn't support specifying 127.0.0.1 in the redirect URIs, last I checked.

Let me know where I can make that clearer in the documentation. Thanks!

rtvu commented 3 months ago

Thanks! I got it to work once I used localhost.

I think adding a small section to "login_and_acl.md" on how to deploy locally where it discusses the 127.0.0.1 limitation and instructs to use localhost would really help.

By the way, since #1812, this is the output when running npm run dev:

> frontend@0.0.0 dev
> vite --host 127.0.0.1

  VITE v4.5.3  ready in 188 ms

  ➜  Local:   http://127.0.0.1:5173/
  ➜  press h to show help