import { redirect } from 'next/navigation'; import { headers } from 'next/headers'; import { auth } from '@/lib/auth'; import { SignOutButton } from './SignOutButton'; export default async function DashboardPage() { const session = await auth.api.getSession({ headers: await headers(), }); if (!session) { redirect('/sign-in'); } const discoveryUrl = `${process.env.BETTER_AUTH_URL || 'http://localhost:3001'}/api/auth/.well-known/openid-configuration`; return (
Email: {session.user.email}
Имя: {session.user.name || '—'}
Этот сервис выступает как OIDC Identity Provider. Подключите ваши приложения, указав следующие параметры:
{`Authorization URL: ${process.env.BETTER_AUTH_URL || 'http://localhost:3001'}/api/auth/oauth2/authorize
Token URL: ${process.env.BETTER_AUTH_URL || 'http://localhost:3001'}/api/auth/oauth2/token
UserInfo URL: ${process.env.BETTER_AUTH_URL || 'http://localhost:3001'}/api/auth/oauth2/userinfo
Discovery: ${discoveryUrl}
Scopes: openid profile email`}
Зарегистрируйте клиента через API{' '}
POST /api/auth/oauth2/register
{' '}
или настройте trusted clients в конфигурации сервиса.