Spaces:
Runtime error
Runtime error
fix space host
Browse files
src/routes/api/auth/login/+server.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { redirect } from '@sveltejs/kit'
|
|
| 2 |
/** @type {import('./$types').RequestHandler} */
|
| 3 |
|
| 4 |
export async function GET() {
|
| 5 |
-
const first_space_host = process.env.SPACE_HOST?.split('.')[
|
| 6 |
const REDIRECT_URI = `https://${first_space_host}/login/callback`
|
| 7 |
|
| 8 |
throw redirect(302, `https://huggingface.co/oauth/authorize?client_id=${process.env.OAUTH_CLIENT_ID}&redirect_uri=${REDIRECT_URI}&scope=openid%20profile&state=STATE&response_type=code`)
|
|
|
|
| 2 |
/** @type {import('./$types').RequestHandler} */
|
| 3 |
|
| 4 |
export async function GET() {
|
| 5 |
+
const first_space_host = process.env.SPACE_HOST?.split('.')[1] ?? process.env.SPACE_HOST
|
| 6 |
const REDIRECT_URI = `https://${first_space_host}/login/callback`
|
| 7 |
|
| 8 |
throw redirect(302, `https://huggingface.co/oauth/authorize?client_id=${process.env.OAUTH_CLIENT_ID}&redirect_uri=${REDIRECT_URI}&scope=openid%20profile&state=STATE&response_type=code`)
|