AnswerDotAI / AnswerDotAI/fasthtml

[FEATURE] OAuth Azure AD/Entra

Open
#718 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Jupyter Notebook
Stars
7k
Forks
319
Avg merge
28m
Merged PRs (30d)
3

Description

Hello

is it posible to add OAuth support for Azure AD or Microsoft Entra ID as it call nowadays.

i have ben playing around in the
https://github.com/AnswerDotAI/fasthtml/blob/main/nbs/api/08_oauth.ipynb

adding somthing like tish

```python
# %% ../nbs/api/08_oauth.ipynb
class AzureAppClient(_AppClient):
"A `WebApplicationClient` for Microsoft Entra (Azure AD)"

def __init__(
self, client_id, client_secret, tenant_id, code=None, scope=None, **kwargs
):
self.tenant_id = tenant_id
self.base_url = (
f"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize"
)
self.token_url = (
f"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token"
)
self.info_url = "https://graph.microsoft.com/oidc/userinfo"

# Microsoft kräver scope med fullständiga URI:er
if not scope:
scope = [
"openid",
"profile",
"email",
"https://graph.microsoft.com/User.Read",
]

super().__init__(client_id, client_secret, code=code, scope=scope, **kwargs)

@classmethod
def from_file(cls, fname, code=None, scope=None, **kwargs):
cred = Path(fname).read_json()
return cls(
cred["client_id"],
client_secret=cred["client_secret"],
tenant_id=cred["tenant_id"],
code=code,
scope=scope,
**kwargs,
)

```

i dont understand the structure of the auth file
its so much @patch going on iam not 100% familr with this

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.