-
Notifications
You must be signed in to change notification settings - Fork 10
Auth: User Invitation flow #739
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
Merged
Merged
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
74d5cfc
config routes updated
vprashrex bd48eb8
code update
vprashrex 10fd7c3
made query optional
vprashrex f73c22a
code updated
vprashrex 0c7175b
added has_more functionality
vprashrex a363f45
refactor: update config CRUD methods to include query parameter and h…
vprashrex abd1fc8
Add projects-by-org endpoint and pagination for organizations list
vprashrex 84ce2e8
Enhance organization validation: return 503 status code for inactive …
vprashrex 6144d98
feat(*): google integration flow
Ayush8923 7f98414
Merge branch 'main' into feat/adding-query-params-to-config
Ayush8923 a7e9139
Merge branch 'feat/adding-query-params-to-config' of https://github.c…
Ayush8923 4cf576b
fix(*): update the js comment
Ayush8923 0b3b30e
fix(*): update the uv.lock
Ayush8923 7e46f7d
feat(*): API for create user corresponding to projects
Ayush8923 a6b6281
fix(*): few updates on user projects
Ayush8923 6731b1d
Merge branch 'main' of https://github.com/ProjectTech4DevAI/kaapi-bac…
Ayush8923 8b3e5e9
Merge branch 'feat/google-integration-auth-flow' of https://github.co…
Ayush8923 6bb875c
fix(*): update the test cases
Ayush8923 b1082a5
Merge branch 'feat/google-integration-auth-flow' of https://github.co…
Ayush8923 3a1c9c8
fix(*): update test coverage
Ayush8923 9e833d8
Merge branch 'feat/google-integration-auth-flow' of https://github.co…
Ayush8923 b22588f
fix(*): update the test cases
Ayush8923 a57f829
Merge branch 'feat/google-integration-auth-flow' of https://github.co…
Ayush8923 d1c9416
Merge branch 'main' into feat/google-integration-auth-flow
Ayush8923 b211652
Merge branch 'feat/google-integration-auth-flow' into feat/add-user-p…
Ayush8923 fd377e8
fix(*): some of the edge cases implementation
Ayush8923 781fccc
Merge branch 'feat/add-user-project' of https://github.com/ProjectTec…
Ayush8923 7133fa1
fix(*): remove the unused vairbales
Ayush8923 5b8af37
fix(*): for the response used the APIResponses utils function
Ayush8923 833bda2
Merge branch 'feat/google-integration-auth-flow' into feat/add-user-p…
Ayush8923 b3eb1fd
fix(*): update the test cases
Ayush8923 ccb11cc
Merge branch 'feat/google-integration-auth-flow' into feat/add-user-p…
Ayush8923 8166675
Merge branch 'main' into feat/google-integration-auth-flow
Ayush8923 a81d18e
Merge branch 'feat/google-integration-auth-flow' into feat/add-user-p…
Ayush8923 280b254
sugg(*): made the changes as per the suggestion
Ayush8923 4e391f8
cleanups(*): stt and tts flow
Ayush8923 e62ed10
fix(*): update the invitation user email html file
Ayush8923 8aa31a0
fix(*): update the invite verify md file
Ayush8923 20fa939
Revert "fix(*): update the invite verify md file"
Ayush8923 eba128a
fix(*): update the invite verify md file
Ayush8923 944a67c
fix(*): added the env example
Ayush8923 74d252b
Add/Delete User in Org/Project (#737)
Ayush8923 ac700af
Merge branch 'main' into feat/google-integration-auth-flow
Ayush8923 71720a3
fix(*): update the test cases
Ayush8923 d9c00c2
fix(*): added the test cases for user project
Ayush8923 6970446
fix(*): update the invite user template
Ayush8923 8810300
Merge branch 'feat/google-integration-auth-flow' of https://github.co…
Ayush8923 254fadc
Merge branch 'main' of https://github.com/ProjectTech4DevAI/kaapi-bac…
Ayush8923 3fec131
fix(*): added the test cases
Ayush8923 e3db12c
fix(*): test cases updates
Ayush8923 a3c946c
Merge branch 'main' into feat/invitation-flow
Ayush8923 de692f4
Merge branch 'main' into feat/invitation-flow
Ayush8923 8640abe
Merge branch 'main' into feat/invitation-flow
AkhileshNegi 8daa10e
fix(*): made the changes as per the suggestion
Ayush8923 d3884cb
Merge branch 'main' into feat/invitation-flow
Ayush8923 7c3fbf7
Merge branch 'main' into feat/invitation-flow
Ayush8923 361dd27
Auth: Email Login Flow (#747)
Ayush8923 889faa4
fix(*): updated the test cases
Ayush8923 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Verify Invitation | ||
|
|
||
| Verify an invitation token from a magic link email and log the user in. | ||
|
|
||
| ## Query Parameters | ||
|
|
||
| - **token** (required): The invitation JWT token from the email link. | ||
|
|
||
| ## Behavior | ||
|
|
||
| 1. Validates the invitation token (checks signature, expiry, and type). | ||
| 2. Looks up the user by the email embedded in the token. | ||
| 3. If the user exists and is inactive (first login), activates the account. | ||
| 4. Returns a JWT access token with the org/project from the invitation embedded. | ||
| 5. Sets `access_token` and `refresh_token` as HTTP-only cookies. | ||
|
|
||
| ## Error Responses | ||
|
|
||
| - **400**: Invalid or expired invitation link. | ||
| - **404**: User account not found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Request Magic Link Login | ||
|
|
||
| Send a magic link login email to the user's email address. | ||
|
|
||
| ## Request Body | ||
|
|
||
| - **email** (required): The user's email address. | ||
|
|
||
| ## Behavior | ||
|
|
||
| 1. Checks if the user exists — returns 404 if not. | ||
| 2. Generates a short-lived login token (15 minutes). | ||
| 3. Sends an email with a "Sign In Now" button linking to the frontend. | ||
|
|
||
| ## Error Responses | ||
|
|
||
| - **404**: No account found for this email. | ||
| - **500**: Email service is not configured or failed to send. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Verify Magic Link | ||
|
|
||
| Verify a magic link login token and log the user in. | ||
|
|
||
| ## Query Parameters | ||
|
|
||
| - **token** (required): The login JWT token from the email link. | ||
|
|
||
| ## Behavior | ||
|
|
||
| 1. Validates the magic link token (checks signature, expiry, and type). | ||
| 2. Looks up the user by the email embedded in the token. | ||
| 3. Verifies the user is active. | ||
| 4. If the user has exactly one project, it is auto-selected and embedded in the JWT. | ||
| 5. Returns a JWT access token and sets HTTP-only cookies. | ||
|
|
||
| ## Error Responses | ||
|
|
||
| - **400**: Invalid or expired login link. | ||
| - **404**: User account not found. |
7 changes: 7 additions & 0 deletions
7
backend/app/api/docs/credentials/delete_all_by_org_project.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Delete all credentials for a specific organization and project. | ||
|
|
||
| Permanently removes all provider credentials associated with the specified organization and project IDs. Requires superuser access. | ||
|
|
||
| ### Path Parameters: | ||
| - **org_id**: Organization ID | ||
| - **project_id**: Project ID |
8 changes: 8 additions & 0 deletions
8
backend/app/api/docs/credentials/delete_provider_by_org_project.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Delete credentials for a specific provider within an organization and project. | ||
|
|
||
| Permanently removes credentials for a specific provider from the specified organization and project. Requires superuser access. | ||
|
|
||
| ### Path Parameters: | ||
| - **org_id**: Organization ID | ||
| - **project_id**: Project ID | ||
| - **provider**: Provider name (e.g., `openai`, `langfuse`, `google`, `sarvamai`, `elevenlabs`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| Get credentials for a specific provider. | ||
|
|
||
| Retrieves decrypted credentials for a specific provider (e.g., `openai`, `langfuse`) for the current organization and project. | ||
| Retrieves credentials for a specific provider (e.g., `openai`, `langfuse`) for the current organization and project. Sensitive fields (e.g., `api_key`, `secret_key`) are masked in the response. If credentials for the provider are not configured, `null` is returned. |
8 changes: 8 additions & 0 deletions
8
backend/app/api/docs/credentials/get_provider_by_org_project.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Get credentials for a specific provider within an organization and project. | ||
|
|
||
| Retrieves credentials for a specific provider (e.g., `openai`, `langfuse`) for the specified organization and project. Sensitive fields (e.g., `api_key`, `secret_key`) are masked in the response. If credentials for the provider are not configured, `null` is returned. Requires superuser access. | ||
|
|
||
| ### Path Parameters: | ||
| - **org_id**: Organization ID | ||
| - **project_id**: Project ID | ||
| - **provider**: Provider name (e.g., `openai`, `langfuse`, `google`, `sarvamai`, `elevenlabs`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| Get all credentials for current organization and project. | ||
|
|
||
| Returns list of all provider credentials associated with your organization and project. | ||
| Returns a list of all provider credentials associated with your organization and project. Sensitive fields (e.g., `api_key`, `secret_key`) are masked in the response. If no credentials are configured, an empty list is returned. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| Get all credentials for a specific organization and project. | ||
|
|
||
| Retrieves all provider credentials associated with the specified organization and project IDs. Sensitive fields (e.g., `api_key`, `secret_key`) are masked in the response. If no credentials are configured, an empty list is returned. Requires superuser access. | ||
|
|
||
| ### Path Parameters: | ||
| - **org_id**: Organization ID | ||
| - **project_id**: Project ID | ||
|
|
||
| ### Supported Providers: | ||
| - **LLM:** openai, sarvamai, google(gemini) | ||
| - **Observability:** langfuse | ||
| - **Audio:** elevenlabs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,34 @@ | ||
| Update credentials for a specific provider. | ||
|
|
||
| Updates existing provider credentials for the current organization and project. Provider and credential fields must be provided. | ||
| Updates existing provider credentials for the current organization and project. If the credentials for the specified provider don't exist yet, they will be **created** automatically (upsert behavior). The `provider` and `credential` fields are required. | ||
|
|
||
| The `credential` field accepts **two formats** (both work the same): | ||
|
|
||
| ### Nested format (same as create endpoint): | ||
| ```json | ||
| { | ||
| "provider": "openai", | ||
| "is_active": true, | ||
| "credential": { | ||
| "openai": { | ||
| "api_key": "sk-proj-..." | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Flat format: | ||
| ```json | ||
| { | ||
| "provider": "openai", | ||
| "is_active": true, | ||
| "credential": { | ||
| "api_key": "sk-proj-..." | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Supported Providers: | ||
| - **LLM:** openai, sarvamai, google(gemini) | ||
| - **Observability:** langfuse | ||
| - **Audio:** elevenlabs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| Update credentials for a specific provider within an organization and project. | ||
|
|
||
| Updates existing provider credentials for the specified organization and project. If the credentials for the specified provider don't exist yet, they will be **created** automatically (upsert behavior). Requires superuser access. | ||
|
|
||
| ### Path Parameters: | ||
| - **org_id**: Organization ID | ||
| - **project_id**: Project ID | ||
|
|
||
| The `credential` field accepts **two formats** (both work the same): | ||
|
|
||
| ### Nested format (same as create endpoint): | ||
| ```json | ||
| { | ||
| "provider": "openai", | ||
| "is_active": true, | ||
| "credential": { | ||
| "openai": { | ||
| "api_key": "sk-proj-..." | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Flat format: | ||
| ```json | ||
| { | ||
| "provider": "openai", | ||
| "is_active": true, | ||
| "credential": { | ||
| "api_key": "sk-proj-..." | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Supported Providers: | ||
| - **LLM:** openai, sarvamai, google(gemini) | ||
| - **Observability:** langfuse | ||
| - **Audio:** elevenlabs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.