Skip to content
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

feat: Add Default role assigning while creating and account or signing in [DEV-2905] #286

Merged
merged 21 commits into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from 20 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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ By default, `ENABLE_AUTHENTICATION` is set to off/`false`. To enable external Ve
3. **Machine-to-machine backend APIs**
1. `LOGTO_M2M_APP_ID`: Application ID for machine-to-machine application in LogTo. This is used for elevated management APIs within LogTo.
2. `LOGTO_M2M_APP_SECRET`: Application secret
4. **Miscellaneous**
4. **Default role update using [LogTo webhooks](https://docs.logto.io/next/docs/recipes/webhooks/)**: LogTo supports webhooks to fire of requests to an API when it detects certain actions/changes. If you want to automatically assign a role to users, a webhook is recommended to be setup for firing off whenever there's a new account created, or a new sign-in.
1. `LOGTO_DEFAULT_ROLE_ID`: LogTo Role ID for the default role to put new users into.
2. `LOGTO_WEBHOOK_SECRET`: Webhook secret to authenticate incoming webhook requests from LogTo.
5. **Miscellaneous**
1. `DEFAULT_CUSTOMER_ID`: Customer/user in LogTo to use for unauthenticated users
2. `COOKIE_SECRET`: Secret for cookie encryption.

Expand Down
4 changes: 4 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ ARG COOKIE_SECRET
ARG LOGTO_M2M_APP_ID
ARG LOGTO_M2M_APP_SECRET
ARG LOGTO_MANAGEMENT_API
ARG LOGTO_DEFAULT_ROLE_ID
ARG LOGTO_WEBHOOK_SECRET

# Verida connector: build-time
ARG ENABLE_VERIDA_CONNECTOR=false
Expand Down Expand Up @@ -103,6 +105,8 @@ ENV COOKIE_SECRET ${COOKIE_SECRET}
ENV LOGTO_M2M_APP_ID ${LOGTO_M2M_APP_ID}
ENV LOGTO_M2M_APP_SECRET ${LOGTO_M2M_APP_SECRET}
ENV LOGTO_MANAGEMENT_API ${LOGTO_MANAGEMENT_API}
ENV LOGTO_DEFAULT_ROLE_ID ${LOGTO_DEFAULT_ROLE_ID}
ENV LOGTO_WEBHOOK_SECRET ${LOGTO_WEBHOOK_SECRET}

# Environment variables: Verida connector
ENV ENABLE_VERIDA_CONNECTOR ${ENABLE_VERIDA_CONNECTOR}
Expand Down
2 changes: 2 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ LOGTO_APP_SECRET='sdf...sdf'
LOGTO_M2M_APP_ID="aaaa...ddddd"
LOGTO_M2M_APP_SECRET="aaaa...ddddd"
LOGTO_MANAGEMENT_API="https://default.logto.app/api"
LOGTO_DEFAULT_ROLE_ID="sdf...sdf"
LOGTO_WEBHOOK_SECRET="sdf...sdf"
COOKIE_SECRET='sdf...sdf'

# Authentication
Expand Down
Loading