Skip to content

Commit

Permalink
fix(auth): FB instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Shchepotin committed Feb 7, 2024
1 parent 2150761 commit 19c8b5e
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/auth-facebook/auth-facebook.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,24 @@ import { AllConfigType } from 'src/config/config.type';

@Injectable()
export class AuthFacebookService {
private fb: Facebook;
constructor(private configService: ConfigService<AllConfigType>) {}

constructor(private configService: ConfigService<AllConfigType>) {
this.fb = new Facebook({
appId: configService.get('facebook.appId', {
async getProfileByToken(
loginDto: AuthFacebookLoginDto,
): Promise<SocialInterface> {
const fb: Facebook = new Facebook({
appId: this.configService.get('facebook.appId', {
infer: true,
}),
appSecret: configService.get('facebook.appSecret', {
appSecret: this.configService.get('facebook.appSecret', {
infer: true,
}),
version: 'v7.0',
});
}

async getProfileByToken(
loginDto: AuthFacebookLoginDto,
): Promise<SocialInterface> {
this.fb.setAccessToken(loginDto.accessToken);
fb.setAccessToken(loginDto.accessToken);

const data: FacebookInterface = await new Promise((resolve) => {
this.fb.api(
fb.api(
'/me',
'get',
{ fields: 'id,last_name,email,first_name' },
Expand Down

0 comments on commit 19c8b5e

Please sign in to comment.