import { Injectable } from '@nestjs/common'; import appleSigninAuth from 'apple-signin-auth'; import { ConfigService } from '@nestjs/config'; import { SocialInterface } from '../social/interfaces/social.interface'; import { AuthAppleLoginDto } from './dto/auth-apple-login.dto'; import { AllConfigType } from 'src/config/config.type'; @Injectable() export class AuthAppleService { constructor(private configService: ConfigService) {} async getProfileByToken( loginDto: AuthAppleLoginDto, ): Promise { const data = await appleSigninAuth.verifyIdToken(loginDto.idToken, { audience: this.configService.get('apple.appAudience', { infer: true }), }); return { id: data.sub, email: data.email, firstName: loginDto.firstName, lastName: loginDto.lastName, }; } }