mirror of
https://github.com/luxfi/mpc.git
synced 2026-09-24 00:26:24 +00:00
fix: use /oauth/authorize for MPC login, rename app in IAM DB
- Changed login redirect from /login to /oauth/authorize (standard OAuth2 authorization endpoint) - IAM app renamed from app-lux-mpc to lux-mpc so implicit flow resolves correctly (Casdoor uses client_id as app name lookup) - Updated E2E tests to match new OAuth flow
This commit is contained in:
@@ -18,7 +18,7 @@ function buildLoginUrl(branding: Branding): string {
|
||||
state,
|
||||
})
|
||||
|
||||
return `${branding.iamUrl}/login?${params.toString()}`
|
||||
return `${branding.iamUrl}/oauth/authorize?${params.toString()}`
|
||||
}
|
||||
|
||||
export default function LoginPage() {
|
||||
|
||||
@@ -38,18 +38,17 @@ test.describe('Lux ID Login Flow', () => {
|
||||
const continueBtn = page.getByRole('button', { name: /Continue with/i })
|
||||
await continueBtn.click()
|
||||
|
||||
await page.waitForURL(/lux\.id\/login/, { timeout: 15_000 })
|
||||
await page.waitForURL(/lux\.id/, { timeout: 15_000 })
|
||||
|
||||
const url = new URL(page.url())
|
||||
expect(url.hostname).toBe('lux.id')
|
||||
expect(url.pathname).toBe('/login')
|
||||
expect(url.searchParams.get('response_type')).toBe('token')
|
||||
// /oauth/authorize redirects to /login with app context
|
||||
expect(url.searchParams.get('client_id')).toBe('lux-mpc')
|
||||
expect(url.searchParams.get('scope')).toContain('openid')
|
||||
})
|
||||
|
||||
test('Lux ID login page loads with email and password fields', async ({ page }) => {
|
||||
const loginUrl = new URL(`${IAM_URL}/login`)
|
||||
const loginUrl = new URL(`${IAM_URL}/oauth/authorize`)
|
||||
loginUrl.searchParams.set('response_type', 'token')
|
||||
loginUrl.searchParams.set('client_id', 'lux-mpc')
|
||||
loginUrl.searchParams.set('redirect_uri', 'https://mpc.lux.network/auth/callback')
|
||||
@@ -80,7 +79,7 @@ test.describe('Lux ID Login Flow', () => {
|
||||
await page.getByRole('button', { name: /Continue with/i }).click()
|
||||
|
||||
// Wait for Lux ID login page
|
||||
await page.waitForURL(/lux\.id\/login/, { timeout: 15_000 })
|
||||
await page.waitForURL(/lux\.id/, { timeout: 15_000 })
|
||||
|
||||
// Fill in credentials
|
||||
await page.getByPlaceholder('Email').fill('[email protected]')
|
||||
@@ -107,7 +106,7 @@ test.describe('Lux ID Login Flow', () => {
|
||||
await page.goto('/login')
|
||||
await page.getByRole('button', { name: /Continue with/i }).click()
|
||||
|
||||
await page.waitForURL(/lux\.id\/login/, { timeout: 15_000 })
|
||||
await page.waitForURL(/lux\.id/, { timeout: 15_000 })
|
||||
|
||||
await page.getByPlaceholder('Email').fill('[email protected]')
|
||||
await page.getByPlaceholder('Password').fill(password!)
|
||||
@@ -151,7 +150,7 @@ test.describe('IAM OIDC Discovery', () => {
|
||||
})
|
||||
|
||||
test('app-lux-mpc application is accessible', async ({ request }) => {
|
||||
const response = await request.get('https://hanzo.id/api/get-application?id=admin/app-lux-mpc')
|
||||
const response = await request.get('https://hanzo.id/api/get-application?id=admin/lux-mpc')
|
||||
expect(response.ok()).toBeTruthy()
|
||||
|
||||
const body = await response.json()
|
||||
|
||||
Reference in New Issue
Block a user