fix(client): add trailing slash to redirect_uri
Signed-off-by: Noa Virellia <noa@requiem.garden>
This commit is contained in:
@@ -32,3 +32,7 @@ export function isInDateRange(start: Date, end: Date, target: Date = new Date())
|
|||||||
const time = target.getTime();
|
const time = target.getTime();
|
||||||
return time >= start.getTime() && time <= end.getTime();
|
return time >= start.getTime() && time <= end.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function addTrailingSlash(path: string): string {
|
||||||
|
return path.endsWith('/') ? path : `${path}/`;
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,13 +7,14 @@ import { LoginForm } from '@/components/login-form';
|
|||||||
import { useExchangeToken } from '@/hooks/data/useExchangeToken';
|
import { useExchangeToken } from '@/hooks/data/useExchangeToken';
|
||||||
import { generateOAuthState } from '@/lib/random';
|
import { generateOAuthState } from '@/lib/random';
|
||||||
import { getAccessToken } from '@/lib/token';
|
import { getAccessToken } from '@/lib/token';
|
||||||
|
import { addTrailingSlash } from '@/lib/utils';
|
||||||
|
|
||||||
const baseUrl = import.meta.env.VITE_APP_BASE_URL;
|
const baseUrl = import.meta.env.VITE_APP_BASE_URL;
|
||||||
|
|
||||||
const authorizeSchema = z.object({
|
const authorizeSchema = z.object({
|
||||||
response_type: z.literal('code').default('code'),
|
response_type: z.literal('code').default('code'),
|
||||||
client_id: z.literal('org_client').default('org_client'),
|
client_id: z.literal('org_client').default('org_client'),
|
||||||
redirect_uri: z.string().default(`${new URL(baseUrl).toString()}token`),
|
redirect_uri: z.string().default(`${addTrailingSlash(new URL(baseUrl).toString())}token`),
|
||||||
state: z.string().default(generateOAuthState()),
|
state: z.string().default(generateOAuthState()),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user