Skip to content

Commit

Permalink
Add handling on registration webhook, add env example
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed May 20, 2024
1 parent 9a08666 commit d8e5bf2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
13 changes: 8 additions & 5 deletions MagicalAuth.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,14 @@ def register(
# Send registration webhook out to third party application such as AGiXT to create a user there.
registration_webhook = os.environ.get("REGISTRATION_WEBHOOK", "")
if registration_webhook:
requests.post(
registration_webhook,
json={"email": self.email},
headers={"Authorization": os.environ.get("ENCRYPTION_SECRET", "")},
)
try:
requests.post(
registration_webhook,
json={"email": self.email},
headers={"Authorization": os.environ.get("ENCRYPTION_SECRET", "")},
)
except Exception as e:
pass
# Return mfa_token for QR code generation
return mfa_token

Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,27 @@ MagicalAuth is a simple but magical authentication system for Python application
- `DATABASE_NAME`: The name of the PostgreSQL database.
- `LOGLEVEL`: The log level for the application. This should be one of `DEBUG`, `INFO`, `WARNING`, `ERROR`, or `CRITICAL`.

### Environment File Example

Replace the values with your own values and save it as `.env` in the root directory of the project.

```env
APP_NAME=MagicalAuth
ALLOWED_DOMAINS=devxt.com,magicalauth.com
ENCRYPTION_SECRET=supersecretkey
MAGICALAUTH_SERVER=http://localhost:12437
MAGIC_LINK_URL=http://localhost:8519
SENDGRID_API_KEY=SG.x
[email protected]
REGISTRATION_WEBHOOK=http://localhost:7437/api/user
DATABASE_USER=postgres
DATABASE_PASSWORD=postgres
DATABASE_HOST=postgres
DATABASE_PORT=5432
DATABASE_NAME=postgres
LOGLEVEL=INFO
```

## Usage

```bash
Expand Down

0 comments on commit d8e5bf2

Please sign in to comment.