📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Accept redirect URL from frontend
Blue Mouse83092d653a97
diff --git a/backend/.env.example b/backend/.env.exampleindex 1a12068cf..7557d8182 100644--- a/backend/.env.example+++ b/backend/.env.example@@ -52,7 +52,6 @@ OIDC_ONLY_AUTH=falseOIDC_DISCOVERY_URL=http://localhost:8080/.well-known/openid-configurationOIDC_CLIENT_ID=OIDC_CLIENT_SECRET=-OIDC_CALLBACK_URL=http://localhost:3000/socialised# Swetrix CDN for storing filesCDN_URL=http://localhost:5006diff --git a/backend/Dockerfile b/backend/Dockerfileindex f90ff8c74..45d87a179 100644--- a/backend/Dockerfile+++ b/backend/Dockerfile@@ -37,8 +37,7 @@ ENV [email protected] \# OIDC Configuration (optional)ENV OIDC_CLIENT_ID='' \OIDC_DISCOVERY_URL='' \- OIDC_CLIENT_SECRET='' \- OIDC_CALLBACK_URL=''+ OIDC_CLIENT_SECRET=''# Install and configure timezoneRUN apk add --no-cache tzdata && \diff --git a/backend/apps/cloud/src/auth/dtos/sso-generate.dto.ts b/backend/apps/cloud/src/auth/dtos/sso-generate.dto.tsindex c0e43ab99..a9182a421 100644--- a/backend/apps/cloud/src/auth/dtos/sso-generate.dto.ts+++ b/backend/apps/cloud/src/auth/dtos/sso-generate.dto.ts@@ -1,5 +1,5 @@import { ApiProperty } from '@nestjs/swagger'-import { IsEnum } from 'class-validator'+import { IsEnum, IsOptional, IsUrl } from 'class-validator'export enum SSOProviders {GOOGLE = 'google',@@ -7,6 +7,15 @@ export enum SSOProviders {}export class SSOGenerateDto {+ @ApiProperty({+ description:+ 'Redirect URL after successful authentication; unused. Only set for compatibility with the Community Edition.',+ required: false,+ })+ @IsOptional()+ @IsUrl()+ redirectUrl: string+@ApiProperty({description: 'SSO provider name',enum: SSOProviders,diff --git a/backend/apps/community/src/auth/auth.service.ts b/backend/apps/community/src/auth/auth.service.tsindex 0e120502d..c10f30f5b 100644--- a/backend/apps/community/src/auth/auth.service.ts+++ b/backend/apps/community/src/auth/auth.service.ts@@ -136,7 +136,6 @@ export class AuthService {discoveryURL: this.configService.get('OIDC_DISCOVERY_URL'),clientID: this.configService.get('OIDC_CLIENT_ID'),clientSecret: this.configService.get('OIDC_CLIENT_SECRET'),- callbackURL: this.configService.get('OIDC_CALLBACK_URL'),scope: 'openid email profile',}}@@ -153,7 +152,7 @@ export class AuthService {return response.json()}- async generateOidcAuthUrl(redirectUrl?: string) {+ async generateOidcAuthUrl(redirectUrl: string) {try {const uuid = generateOIDCState()@@ -169,7 +168,7 @@ export class AuthService {const config = this.getOidcConfig()return {- auth_url: `${discovery.authorization_endpoint}?client_id=${config.clientID}&response_type=code&scope=${encodeURIComponent(config.scope)}&redirect_uri=${encodeURIComponent(config.callbackURL)}&state=${uuid}`,+ auth_url: `${discovery.authorization_endpoint}?client_id=${config.clientID}&response_type=code&scope=${encodeURIComponent(config.scope)}&redirect_uri=${encodeURIComponent(redirectUrl)}&state=${uuid}`,uuid,expires_in: REDIS_OIDC_SESSION_TIMEOUT * 1000, // milliseconds}@@ -254,7 +253,7 @@ export class AuthService {client_id: config.clientID,client_secret: config.clientSecret,code,- redirect_uri: config.callbackURL,+ // redirect_uri: config.callbackURL,}).toString(),})diff --git a/backend/apps/community/src/auth/dtos/oidc-auth.dto.ts b/backend/apps/community/src/auth/dtos/oidc-auth.dto.tsindex 4daf8ff12..f440fdeeb 100644--- a/backend/apps/community/src/auth/dtos/oidc-auth.dto.ts+++ b/backend/apps/community/src/auth/dtos/oidc-auth.dto.ts@@ -4,11 +4,9 @@ import { IsString, IsOptional, IsUrl } from 'class-validator'export class OIDCInitiateDto {@ApiProperty({description: 'Redirect URL after successful authentication',- required: false,})@IsUrl()- @IsOptional()- redirectUrl?: string+ redirectUrl: string@ApiProperty({description:diff --git a/web/app/pages/Auth/Signin/Signin.tsx b/web/app/pages/Auth/Signin/Signin.tsxindex 2838083b4..1fe76f39d 100644--- a/web/app/pages/Auth/Signin/Signin.tsx+++ b/web/app/pages/Auth/Signin/Signin.tsx@@ -97,7 +97,11 @@ const Signin = () => {}try {- const { uuid, auth_url: authUrl, expires_in: expiresIn } = await generateSSOAuthURL(provider)+ const {+ uuid,+ auth_url: authUrl,+ expires_in: expiresIn,+ } = await generateSSOAuthURL(provider, `${window.location.origin}${routes.socialised}`)authWindow.location = authUrl