feat: add Twitter social login support by updating the auth service and user schema.
This commit is contained in:
@@ -185,7 +185,11 @@ export class AuthService {
|
||||
// ==========================================
|
||||
async socialAuth(dto: SocialAuthDto) {
|
||||
const providerIdField =
|
||||
dto.provider === 'google' ? 'googleId' : 'facebookId';
|
||||
dto.provider === 'google'
|
||||
? 'googleId'
|
||||
: dto.provider === 'facebook'
|
||||
? 'facebookId'
|
||||
: 'twitterId';
|
||||
|
||||
// Check if user exists with this provider ID
|
||||
let user = await this.prisma.user.findFirst({
|
||||
@@ -218,7 +222,9 @@ export class AuthService {
|
||||
const authProvider =
|
||||
dto.provider === 'google'
|
||||
? AuthProvider.GOOGLE
|
||||
: AuthProvider.FACEBOOK;
|
||||
: dto.provider === 'facebook'
|
||||
? AuthProvider.FACEBOOK
|
||||
: AuthProvider.TWITTER;
|
||||
|
||||
// Parse name
|
||||
const nameParts = dto.name?.split(' ') || [];
|
||||
|
||||
Reference in New Issue
Block a user