facebook-ts
A facebook API for the Node.JS backend in TypeScript.
Installation
npm install facebook-ts --save
Usage
// TypeScript // JavaScriptvar FB = FBsettings;FBsettings; FB ;
API
Settings
setSecret
=> void;
Set the secret as provided by Facebook
getSecret
=> string;
Returns the secret that you provided
setClientId
=> void;
Set the client id as provided by Facebook
getClientId
=> string;
Returns the client id that you provided
setApiVersion
=> void;
...
getApiVersion
=> string;
accessToken
=> Promise<string>;
Get an access token from Facebook for accessing the rest of the API.
Use the stored token is one is present.
verifyToken
=> Promise<TokenStatus>;
See: Status and TokenStatus
Returns the status of a user's session/token.
userStatus
is an object provided by the Facebook SDK function getLoginStatus()
.
getUser
=> Promise<User>;
See User
Interfaces
Status
interface Status status: string; authResponse: accessToken: string; expiresIn: string; signedRequest: string; userID: string;
TokenStatus
interface TokenStatus data?: app_id: string; application: string; expires_at: number; is_valid: boolean; scopes: Array<string>; user_id: string; error?: code: number; message: string; subcode: number; error?: message: string type: string is_transient: boolean code: number
User
interface User name: string; id: string;