website/docs: Update flow to run only during Github logins (#2959)

This commit is contained in:
TheMythologist 2022-05-27 22:07:33 +08:00 committed by GitHub
parent 2b68363452
commit 5f04a187ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -57,6 +57,10 @@ Requires authentik 2021.12.5.
To check if the user is member of an organisation, you can use the following policy on your flows: To check if the user is member of an organisation, you can use the following policy on your flows:
```python ```python
# Ensure flow is only run during oauth logins via Github
if context['source'].provider_type != "github":
return True
accepted_org = "foo" accepted_org = "foo"
# Get the user-source connection object from the context, and get the access token # Get the user-source connection object from the context, and get the access token