expo-bbase 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +61 -65
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1219,92 +1219,88 @@ var auth_google_default = authGoogleModule;
|
|
|
1219
1219
|
var authFacebookModule = {
|
|
1220
1220
|
id: "auth-facebook",
|
|
1221
1221
|
name: "Facebook \u767B\u5F55",
|
|
1222
|
-
description: "expo-facebook",
|
|
1222
|
+
description: "expo-auth-session + expo-web-browser\uFF08SDK 54 \u4E0D\u518D\u652F\u6301 expo-facebook\uFF09",
|
|
1223
1223
|
defaultChecked: false,
|
|
1224
1224
|
dependencies: {
|
|
1225
|
-
"expo-
|
|
1225
|
+
"expo-auth-session": "~7.0.11",
|
|
1226
|
+
"expo-web-browser": "~15.0.11",
|
|
1227
|
+
"expo-crypto": "~15.0.9"
|
|
1226
1228
|
},
|
|
1227
1229
|
devDependencies: {},
|
|
1228
1230
|
files: [
|
|
1229
1231
|
{
|
|
1230
1232
|
path: "modules/auth/facebook.ts",
|
|
1231
1233
|
content: lines(
|
|
1232
|
-
'import
|
|
1234
|
+
'import { responseTypes } from "expo-auth-session";',
|
|
1235
|
+
'import { makeRedirectUri, useAuthRequest, useAutoDiscovery } from "expo-auth-session";',
|
|
1236
|
+
'import * as WebBrowser from "expo-web-browser";',
|
|
1233
1237
|
"",
|
|
1238
|
+
"// Facebook OAuth \u914D\u7F6E",
|
|
1234
1239
|
"export interface FacebookAuthConfig {",
|
|
1235
|
-
"
|
|
1236
|
-
" appName: string;",
|
|
1240
|
+
" clientId: string; // Facebook App ID",
|
|
1237
1241
|
"}",
|
|
1238
1242
|
"",
|
|
1239
|
-
"
|
|
1240
|
-
"
|
|
1241
|
-
"
|
|
1242
|
-
" appName: config.appName,",
|
|
1243
|
-
" });",
|
|
1244
|
-
"}",
|
|
1243
|
+
"// Facebook OAuth \u7AEF\u70B9",
|
|
1244
|
+
'const FACEBOOK_AUTH_ENDPOINT = "https://www.facebook.com/v18.0/dialog/oauth";',
|
|
1245
|
+
'const FACEBOOK_TOKEN_ENDPOINT = "https://graph.facebook.com/v18.0/oauth/access_token";',
|
|
1245
1246
|
"",
|
|
1246
|
-
"
|
|
1247
|
-
"
|
|
1248
|
-
" userId: string | null;",
|
|
1249
|
-
" userName: string | null;",
|
|
1250
|
-
" error: string | null;",
|
|
1251
|
-
"}> {",
|
|
1252
|
-
" try {",
|
|
1253
|
-
" const result = await Facebook.logInWithReadPermissionsAsync({",
|
|
1254
|
-
' permissions: ["public_profile", "email"],',
|
|
1255
|
-
" });",
|
|
1247
|
+
"// \u786E\u4FDD WebBrowser \u56DE\u8C03\u5B8C\u6210\u65F6\u5173\u95ED",
|
|
1248
|
+
"WebBrowser.maybeCompleteAuthSession();",
|
|
1256
1249
|
"",
|
|
1257
|
-
|
|
1258
|
-
"
|
|
1259
|
-
"
|
|
1260
|
-
"
|
|
1261
|
-
"
|
|
1250
|
+
"/**",
|
|
1251
|
+
" * \u4F7F\u7528 expo-auth-session \u5B9E\u73B0 Facebook \u767B\u5F55",
|
|
1252
|
+
" *",
|
|
1253
|
+
" * \u7528\u6CD5\uFF1A",
|
|
1254
|
+
" * 1. \u5728 Facebook Developer Console \u521B\u5EFA\u5E94\u7528\uFF0C\u83B7\u53D6 App ID",
|
|
1255
|
+
" * 2. \u914D\u7F6E OAuth \u91CD\u5B9A\u5411 URI",
|
|
1256
|
+
" * 3. \u5728\u7EC4\u4EF6\u4E2D\u4F7F\u7528 useFacebookAuth hook",
|
|
1257
|
+
" *",
|
|
1258
|
+
" * \u6CE8\u610F\uFF1ASDK 54 \u4E0D\u518D\u652F\u6301 expo-facebook\uFF0C\u6539\u7528 expo-auth-session",
|
|
1259
|
+
" */",
|
|
1262
1260
|
"",
|
|
1263
|
-
"
|
|
1264
|
-
"
|
|
1265
|
-
"
|
|
1266
|
-
"
|
|
1267
|
-
"
|
|
1268
|
-
"
|
|
1269
|
-
"
|
|
1270
|
-
"
|
|
1271
|
-
"
|
|
1272
|
-
"
|
|
1273
|
-
"
|
|
1274
|
-
|
|
1275
|
-
"
|
|
1261
|
+
"export function useFacebookAuth(config: FacebookAuthConfig) {",
|
|
1262
|
+
" const redirectUri = makeRedirectUri({",
|
|
1263
|
+
" scheme: 'your-app-scheme', // \u66FF\u6362\u4E3A\u4F60\u7684 app scheme",
|
|
1264
|
+
" });",
|
|
1265
|
+
"",
|
|
1266
|
+
" const [request, response, promptAsync] = useAuthRequest(",
|
|
1267
|
+
" {",
|
|
1268
|
+
" clientId: config.clientId,",
|
|
1269
|
+
" scopes: ['public_profile', 'email'],",
|
|
1270
|
+
" redirectUri,",
|
|
1271
|
+
" },",
|
|
1272
|
+
" {",
|
|
1273
|
+
" authorizationEndpoint: FACEBOOK_AUTH_ENDPOINT,",
|
|
1274
|
+
" tokenEndpoint: FACEBOOK_TOKEN_ENDPOINT,",
|
|
1276
1275
|
" }",
|
|
1277
|
-
"
|
|
1278
|
-
|
|
1279
|
-
"
|
|
1280
|
-
" token: null,",
|
|
1281
|
-
" userId: null,",
|
|
1282
|
-
" userName: null,",
|
|
1283
|
-
' error: "Facebook \u767B\u5F55\u5931\u8D25",',
|
|
1284
|
-
" };",
|
|
1285
|
-
" }",
|
|
1276
|
+
" );",
|
|
1277
|
+
"",
|
|
1278
|
+
" return { request, response, promptAsync };",
|
|
1286
1279
|
"}",
|
|
1287
1280
|
"",
|
|
1288
|
-
"
|
|
1289
|
-
"
|
|
1290
|
-
"
|
|
1291
|
-
"
|
|
1292
|
-
|
|
1293
|
-
"
|
|
1281
|
+
"/**",
|
|
1282
|
+
" * \u4ECE Facebook OAuth \u54CD\u5E94\u4E2D\u63D0\u53D6\u7528\u6237\u4FE1\u606F",
|
|
1283
|
+
" */",
|
|
1284
|
+
"export async function getFacebookUserInfo(accessToken: string): Promise<{",
|
|
1285
|
+
" userId: string;",
|
|
1286
|
+
" userName: string;",
|
|
1287
|
+
" email: string | null;",
|
|
1288
|
+
"}> {",
|
|
1289
|
+
" const response = await fetch(",
|
|
1290
|
+
" `https://graph.facebook.com/me?access_token=${accessToken}&fields=id,name,email`",
|
|
1291
|
+
" );",
|
|
1292
|
+
" const userData = await response.json();",
|
|
1293
|
+
"",
|
|
1294
|
+
" return {",
|
|
1295
|
+
" userId: userData.id,",
|
|
1296
|
+
" userName: userData.name,",
|
|
1297
|
+
" email: userData.email ?? null,",
|
|
1298
|
+
" };",
|
|
1294
1299
|
"}"
|
|
1295
1300
|
)
|
|
1296
1301
|
}
|
|
1297
1302
|
],
|
|
1298
|
-
appConfig: {
|
|
1299
|
-
plugins: [
|
|
1300
|
-
[
|
|
1301
|
-
"expo-facebook",
|
|
1302
|
-
{
|
|
1303
|
-
appId: "YOUR_FACEBOOK_APP_ID"
|
|
1304
|
-
}
|
|
1305
|
-
]
|
|
1306
|
-
]
|
|
1307
|
-
}
|
|
1303
|
+
appConfig: {}
|
|
1308
1304
|
};
|
|
1309
1305
|
var auth_facebook_default = authFacebookModule;
|
|
1310
1306
|
|
|
@@ -4215,7 +4211,7 @@ function generateBasePackageJson(projectName) {
|
|
|
4215
4211
|
|
|
4216
4212
|
// src/index.ts
|
|
4217
4213
|
var import_execa = require("execa");
|
|
4218
|
-
var CLI_VERSION = "1.3.
|
|
4214
|
+
var CLI_VERSION = "1.3.5";
|
|
4219
4215
|
var CONFIG_FILE = ".expo-bbase.json";
|
|
4220
4216
|
async function run() {
|
|
4221
4217
|
const program = new import_commander.Command();
|