Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(auth): improve OAuth scopes handling and update redirect URI in documentation

Andrej Acevski92a345bd3752
diff --git a/apps/api/src/auth.ts b/apps/api/src/auth.ts
index 759f44ad5..428c4a0bd 100644
--- a/apps/api/src/auth.ts
+++ b/apps/api/src/auth.ts
@@ -199,7 +199,9 @@ export const auth = betterAuth({
authorizationUrl: process.env.CUSTOM_OAUTH_AUTHORIZATION_URL || "",
tokenUrl: process.env.CUSTOM_OAUTH_TOKEN_URL || "",
userInfoUrl: process.env.CUSTOM_OAUTH_USER_INFO_URL || "",
- scopes: process.env.CUSTOM_OAUTH_SCOPES?.split(",") || [],
+ scopes: process.env.CUSTOM_OAUTH_SCOPES?.split(",")
+ .map((s) => s.trim())
+ .filter(Boolean) || ["profile", "email"],
responseType: process.env.CUSTOM_OAUTH_RESPONSE_TYPE || "code",
discoveryUrl: process.env.CUSTOM_OAUTH_DISCOVERY_URL || "",
pkce: process.env.CUSTOM_AUTH_PKCE !== "false",
diff --git a/apps/docs/content/docs/core/social-providers/custom-oauth.mdx b/apps/docs/content/docs/core/social-providers/custom-oauth.mdx
index dcdfaf51c..ad3198bef 100644
--- a/apps/docs/content/docs/core/social-providers/custom-oauth.mdx
+++ b/apps/docs/content/docs/core/social-providers/custom-oauth.mdx
@@ -38,8 +38,8 @@ First, create an OAuth 2.0 or OIDC application in your identity provider:
1. Log in to your identity provider's admin console
2. Create a new OAuth 2.0 or OIDC application
-3. Set the redirect URI to: `{KANEO_API_URL}/api/auth/callback/custom`
- - Example: `https://api.kaneo.example.com/api/auth/callback/custom`
+3. Set the redirect URI to: `{KANEO_API_URL}/api/auth/oauth2/callback/custom`
+ - Example: `https://api.kaneo.example.com/api/auth/oauth2/callback/custom`
4. Copy the client ID and client secret
5. Note the authorization, token, and userinfo endpoint URLs
@@ -142,13 +142,13 @@ CUSTOM_OAUTH_SCOPES=openid,profile,email
Verify that your redirect URI in the OAuth provider matches exactly:
```
-{KANEO_API_URL}/api/auth/callback/custom
+{KANEO_API_URL}/api/auth/oauth2/callback/custom
```
For example, if `KANEO_API_URL=https://api.kaneo.example.com`, the redirect URI should be:
```
-https://api.kaneo.example.com/api/auth/callback/custom
+https://api.kaneo.example.com/api/auth/oauth2/callback/custom
```
## Discovery URL