Skip to content

Update oauth_example/ to use hd claim #71

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions oauth_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This directory contains some examples of OAuth in action. See the [docs](https://docs.fastht.ml/explains/oauth.html) for a more detailed explanation.

- minimal.py - initializes an OAuth client and retrieves the user's profile, displaying it in the browser after a successful login.
- oa.py - a minimal example showing use of the OAuth class, gating access to the homepage to users with answer.ai email addresses.
- oa.py - a minimal example showing use of the OAuth class, gating access to the homepage to users who belong to the Google domain "answer.ai"
- database.py - a legacy example used in an OAuth explanation, not recommended for use.


Expand All @@ -13,4 +13,4 @@ These examples require two environment variables to be set. Run with:
export AUTH_CLIENT_ID=your_client_id
export AUTH_CLIENT_SECRET=your_client_secret
python minimal.py
```
```
3 changes: 1 addition & 2 deletions oauth_example/oa.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

class Auth(OAuth):
def get_auth(self, info, ident, session, state):
email = info.email or ''
if info.email_verified and email.split('@')[-1]=='answer.ai':
if info.hd == 'answer.ai':
return RedirectResponse('/', status_code=303)

app = FastHTML()
Expand Down