UNPKG

react-native-fbsdk-next

Version:
48 lines (44 loc) 1.17 kB
/** * @format */ import { Platform, NativeModules } from 'react-native'; const AuthenticationToken = NativeModules.FBAuthenticationToken; /** * Represents an immutable access token for using Facebook services. */ class FBAuthenticationToken { /** The raw token string from the authentication response */ /** The nonce from the decoded authentication response */ /** The graph domain where the user is authenticated. */ constructor(tokenMap) { this.authenticationToken = tokenMap.authenticationToken; this.nonce = tokenMap.nonce; this.graphDomain = tokenMap.graphDomain; Object.freeze(this); } /** * Getter for the authentication token */ static getAuthenticationTokenIOS() { if (Platform.OS === 'android') { return Promise.resolve(null); } return new Promise(resolve => { AuthenticationToken.getAuthenticationToken(tokenMap => { if (tokenMap) { resolve(new FBAuthenticationToken(tokenMap)); } else { resolve(null); } }); }); } } export default FBAuthenticationToken; //# sourceMappingURL=FBAuthenticationToken.js.map