akseljoonas HF Staff commited on
Commit
ac2277d
·
1 Parent(s): c4c961e
Files changed (2) hide show
  1. README.md +1 -2
  2. backend/routes/auth.py +4 -7
README.md CHANGED
@@ -11,6 +11,7 @@ hf_oauth_scopes:
11
  - write-repos
12
  - contribute-repos
13
  - manage-repos
 
14
  - jobs
15
  - write-discussions
16
  ---
@@ -51,10 +52,8 @@ ANTHROPIC_API_KEY=<one-key-to-rule-them-all>
51
  HF_TOKEN=<hf-token-to-access-the-hub>
52
  GITHUB_TOKEN=<gh-pat-key-for-not-reinventing-the-wheel>
53
  HF_NAMESPACE=<hf-namespace-to-use>
54
- HF_OAUTH_ORG_ID=<org-id-for-oauth-org-access>
55
  ```
56
 
57
-
58
  ## Architecture
59
 
60
  ### Component Overview
 
11
  - write-repos
12
  - contribute-repos
13
  - manage-repos
14
+ - inference-api
15
  - jobs
16
  - write-discussions
17
  ---
 
52
  HF_TOKEN=<hf-token-to-access-the-hub>
53
  GITHUB_TOKEN=<gh-pat-key-for-not-reinventing-the-wheel>
54
  HF_NAMESPACE=<hf-namespace-to-use>
 
55
  ```
56
 
 
57
  ## Architecture
58
 
59
  ### Component Overview
backend/routes/auth.py CHANGED
@@ -10,11 +10,10 @@ import time
10
  from urllib.parse import urlencode
11
 
12
  import httpx
 
13
  from fastapi import APIRouter, Depends, HTTPException, Request
14
  from fastapi.responses import RedirectResponse
15
 
16
- from dependencies import AUTH_ENABLED, get_current_user
17
-
18
  router = APIRouter(prefix="/auth", tags=["auth"])
19
 
20
  # OAuth configuration from environment
@@ -71,12 +70,10 @@ async def oauth_login(request: Request) -> RedirectResponse:
71
  "scope": "openid profile",
72
  "response_type": "code",
73
  "state": state,
 
 
 
74
  }
75
- # Request access to org resources (jobs, repos) so the user's token
76
- # is scoped to the org.
77
- org_id = os.environ.get("HF_OAUTH_ORG_ID", "698dbf55845d85df163175f1") # ml-agent-explorers
78
- if org_id:
79
- params["orgIds"] = org_id
80
  auth_url = f"{OPENID_PROVIDER_URL}/oauth/authorize?{urlencode(params)}"
81
 
82
  return RedirectResponse(url=auth_url)
 
10
  from urllib.parse import urlencode
11
 
12
  import httpx
13
+ from dependencies import AUTH_ENABLED, get_current_user
14
  from fastapi import APIRouter, Depends, HTTPException, Request
15
  from fastapi.responses import RedirectResponse
16
 
 
 
17
  router = APIRouter(prefix="/auth", tags=["auth"])
18
 
19
  # OAuth configuration from environment
 
70
  "scope": "openid profile",
71
  "response_type": "code",
72
  "state": state,
73
+ "orgIds": os.environ.get(
74
+ "HF_OAUTH_ORG_ID", "698dbf55845d85df163175f1"
75
+ ), # ml-agent-explorers
76
  }
 
 
 
 
 
77
  auth_url = f"{OPENID_PROVIDER_URL}/oauth/authorize?{urlencode(params)}"
78
 
79
  return RedirectResponse(url=auth_url)