@smartsoft001/fb
Version:
Utils for fb authorisation
26 lines (20 loc) • 613 B
text/typescript
import { Injectable } from '@nestjs/common';
import { HttpService } from '@nestjs/axios';
()
export class FbService {
constructor(private http: HttpService) {}
async getUserId(token: string): Promise<string> {
const { data } = await this.http
.get('https://graph.facebook.com/me?access_token=' + token)
.toPromise();
return data.id;
}
async getData(token: string): Promise<{ id; email }> {
const { data } = await this.http
.get(
'https://graph.facebook.com/me?fields=email,id&access_token=' + token,
)
.toPromise();
return data;
}
}