mb3*_*mb3 8 facebook-login create-react-native-app
我试图找到一种方法来使用Facebook登录和Android和IOS的Create-react-native-app.那可能吗?这一切看起来都很新......
fxl*_*ire 10
使用Expo SDK.这样您就不必从create-react-native-app中弹出.
import { Facebook } from 'expo';
async function logIn() {
const { type, token } = await Facebook.logInWithReadPermissionsAsync('<APP_ID>', {
permissions: ['public_profile'],
});
if (type === 'success') {
// Get the user's name using Facebook's Graph API
const response = await fetch(`https://graph.facebook.com/me?access_token=${token}`);
Alert.alert(
'Logged in!',
`Hi ${(await response.json()).name}!`,
);
}
}
Run Code Online (Sandbox Code Playgroud)
从链接中取出的片段.
| 归档时间: |
|
| 查看次数: |
2044 次 |
| 最近记录: |