Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AzureAD scope is hardcoded to Read.All #1804

Open
OliverKleinBST opened this issue Jan 25, 2025 · 5 comments
Open

AzureAD scope is hardcoded to Read.All #1804

OliverKleinBST opened this issue Jan 25, 2025 · 5 comments
Labels
auth Pertaining to authentication. enhancement New feature or request needs-triage

Comments

@OliverKleinBST
Copy link

I would like to use the provided Azure Active Directory class to login to my single tenant auth provider. For this I have setup an app registration and provide respective settings. However my enterprise rules do not allow me to use read.all scope but readbasic.all.

Unfortunatly the scope today is hardcoded. My feature request is to make it configurable using some environment variable like AZURE_AUTH_SCOPE.

@jmanhype
Copy link

jmanhype commented Jan 25, 2025 via email

@dosubot dosubot bot added auth Pertaining to authentication. enhancement New feature or request labels Jan 25, 2025
@OliverKleinBST
Copy link
Author

Thank you for reporting this issue regarding the hardcoded AzureAD scope. I
understand that you need to use readbasic.all instead of read.all scope due
to your enterprise rules.

Making the Azure AD scope configurable through an environment variable is a
reasonable request that would improve flexibility for different enterprise
environments. I'll create a task to implement this enhancement.

For tracking purposes, could you share:

  1. What specific error messages you're encountering with the current
    read.all scope
  2. Any other Azure AD scopes that might be useful to support

This will help us better understand the requirements and implement a more
comprehensive solution.

In the meantime, as a workaround, you might need to fork the repository and
modify the scope manually in your local version.

Sent via Lindy https://lindy.ai

  1. I get HTTP Error 400 when trying to use a scope that is not granted (admin approval required). In my case admin grant exists only for User.ReadBasic.All and not for User.Read. When I clone chainlit and change in class AzureADOAuthProvider(OAuthProvider) from "scope": "https://graph.microsoft.com/User.Read" to "ReadBasic.All" (without graph url) it works.
  2. ideally the scope can be set via a configurable environment variable, so that there is full freedom. Typical use cases for me on top of the ReadBasic.All are "api:/myownscope" or also "openid profile".

@jmanhype
Copy link

jmanhype commented Jan 25, 2025 via email

@OliverKleinBST
Copy link
Author

Thank you for providing those details. This helps clarify the issue
significantly.

Based on your feedback, I understand that we need to:

Fix the current implementation where:

  • The hardcoded User.Read scope causes HTTP 400 errors when not
    pre-approved
    • The Graph URL prefix needs to be handled properly for different
      scope types

Add configuration flexibility to support:

  • Microsoft Graph API scopes (e.g., User.ReadBasic.All)
    • Custom API scopes (e.g., api:/myownscope)
    • OpenID scopes (e.g., openid profile)

I'll update the issue to propose implementing an AZURE_AUTH_SCOPE
environment variable that accepts a space-separated list of scopes, with
the Graph API URL prefix being automatically added only for Microsoft Graph
scopes.

Would you be interested in contributing this change via a pull request? If
not, I'll work on implementing this enhancement.

Sent via Lindy https://lindy.ai

I would prefer not to contribute via pull request myself.

@jmanhype
Copy link

jmanhype commented Jan 25, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Pertaining to authentication. enhancement New feature or request needs-triage
Projects
None yet
Development

No branches or pull requests

2 participants