simplify to always use email from cfIdentity

Signed-off-by: Tyler Davis <tylerd@canva.com>
This commit is contained in:
Tyler Davis
2025-01-11 08:06:39 +11:00
parent d4a8246fd1
commit 96a6c36bb4
2 changed files with 2 additions and 2 deletions
@@ -25,7 +25,7 @@ describe('authenticator', () => {
const profile = await auth.defaultProfileTransform(
{
cfIdentity: { name: 'Name' } as any,
cfIdentity: { name: 'Name', email: 'hello@example.com' } as any,
claims: { email: 'hello@example.com' } as any,
token: 'fake',
},
@@ -38,7 +38,7 @@ export function createCloudflareAccessAuthenticator(options?: {
async defaultProfileTransform(result: CloudflareAccessResult) {
return {
profile: {
email: result.claims.email ?? result.cfIdentity.email,
email: result.cfIdentity.email,
displayName: result.cfIdentity.name,
},
};