Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@capacitor-community/facebook-login

Package Overview
Dependencies
Maintainers
26
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor-community/facebook-login - npm Package Compare versions

Comparing version 1.1.0 to 3.0.0-1

dist/docs.json

23

dist/esm/definitions.d.ts

@@ -1,6 +0,1 @@

declare module '@capacitor/core' {
interface PluginRegistry {
FacebookLogin: FacebookLoginPlugin;
}
}
export interface AccessToken {

@@ -34,1 +29,19 @@ applicationId?: string;

}
export interface FacebookGetLoginStatusResponse {
status: 'connected';
authResponse: {
accessToken: string;
expiresIn: number;
reauthorize_required_in: number;
signedRequest: string;
userID: string;
};
}
export interface FacebookError {
message: string;
type: string;
code: number;
}
export interface FacebookGetProfileResponse {
error: FacebookError | null;
}

@@ -0,1 +1,2 @@

export {};
//# sourceMappingURL=definitions.js.map

@@ -0,2 +1,4 @@

import type { FacebookLoginPlugin } from './definitions';
declare const FacebookLogin: FacebookLoginPlugin;
export * from './definitions';
export * from './web';
export { FacebookLogin };

@@ -0,3 +1,7 @@

import { registerPlugin } from '@capacitor/core';
const FacebookLogin = registerPlugin('FacebookLogin', {
web: () => import('./web').then(m => new m.FacebookLoginWeb()),
});
export * from './definitions';
export * from './web';
export { FacebookLogin };
//# sourceMappingURL=index.js.map

@@ -19,3 +19,1 @@ import { WebPlugin } from '@capacitor/core';

}
declare const FacebookLogin: FacebookLoginWeb;
export { FacebookLogin };

@@ -1,10 +0,1 @@

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { WebPlugin } from '@capacitor/core';

@@ -18,74 +9,66 @@ export class FacebookLoginWeb extends WebPlugin {

}
login(options) {
return __awaiter(this, void 0, void 0, function* () {
console.log('FacebookLoginWeb.login', options);
return new Promise((resolve, reject) => {
FB.login(response => {
console.debug('FB.login', response);
if (response.status === 'connected') {
resolve({
accessToken: {
token: response.authResponse.accessToken,
},
});
}
else {
reject({
accessToken: {
token: null,
},
});
}
}, { scope: options.permissions.join(',') });
});
async login(options) {
console.log('FacebookLoginWeb.login', options);
return new Promise((resolve, reject) => {
FB.login(response => {
console.debug('FB.login', response);
if (response.status === 'connected') {
resolve({
accessToken: {
token: response.authResponse.accessToken,
},
});
}
else {
reject({
accessToken: {
token: null,
},
});
}
}, { scope: options.permissions.join(',') });
});
}
logout() {
return __awaiter(this, void 0, void 0, function* () {
return new Promise(resolve => {
FB.logout(() => resolve());
});
async logout() {
return new Promise(resolve => {
FB.logout(() => resolve());
});
}
getCurrentAccessToken() {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
FB.getLoginStatus(response => {
if (response.status === 'connected') {
const result = {
accessToken: {
applicationId: null,
declinedPermissions: [],
expires: null,
isExpired: null,
lastRefresh: null,
permissions: [],
token: response.authResponse.accessToken,
userId: response.authResponse.userID,
},
};
resolve(result);
}
else {
reject({
accessToken: {
token: null,
},
});
}
});
async getCurrentAccessToken() {
return new Promise((resolve, reject) => {
FB.getLoginStatus(response => {
if (response.status === 'connected') {
const result = {
accessToken: {
applicationId: undefined,
declinedPermissions: [],
expires: undefined,
isExpired: undefined,
lastRefresh: undefined,
permissions: [],
token: response.authResponse.accessToken,
userId: response.authResponse.userID,
},
};
resolve(result);
}
else {
reject({
accessToken: {
token: null,
},
});
}
});
});
}
getProfile(options) {
return __awaiter(this, void 0, void 0, function* () {
const fields = options.fields.join(',');
return new Promise((resolve, reject) => {
FB.api('/me', { fields }, response => {
if (response.error) {
reject(response.error.message);
return;
}
resolve(response);
});
async getProfile(options) {
const fields = options.fields.join(',');
return new Promise((resolve, reject) => {
FB.api('/me', { fields }, response => {
if (response.error) {
reject(response.error.message);
return;
}
resolve(response);
});

@@ -95,6 +78,2 @@ });

}
const FacebookLogin = new FacebookLoginWeb();
export { FacebookLogin };
import { registerWebPlugin } from '@capacitor/core';
registerWebPlugin(FacebookLogin);
//# sourceMappingURL=web.js.map
{
"name": "@capacitor-community/facebook-login",
"version": "1.1.0",
"version": "3.0.0-1",
"description": "A native plugin for Facebook Login",
"main": "dist/esm/index.js",
"main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"unpkg": "dist/plugin.js",
"files": [
"android/src/main/",
"android/build.gradle",
"dist/",
"ios/Plugin/",
"CapacitorCommunityAdmob.podspec"
],
"author": "Masahiko Sakakibara <sakakibara@rdlabo.jp>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git@github.com:capacitor-community/facebook-login.git"
},
"bugs": {
"url": "git@github.com:capacitor-community/facebook-login.git/issues"
},
"scripts": {
"build": "npm run clean && tsc",
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
"verify:android": "cd android && ./gradlew clean build test && cd ..",
"verify:web": "npm run build",
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- autocorrect --format",
"eslint": "eslint . --ext ts",
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
"docgen": "docgen --api FacebookLoginPlugin --output-readme README_AUTO.md --output-json dist/docs.json",
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build",
"release": "np",
"lint": "npm run prettier -- --check",
"fmt": "npm run prettier -- --write && npm run swiftlint -- autocorrect",
"prettier": "prettier \"{android/src,src}/**/*.{css,html,java,js,ts}\"",
"swiftlint": "swiftlint"
"release": "np --any-branch"
},
"author": "Masahiko Sakakibara <sakakibara@rdlabo.jp>",
"license": "MIT",
"devDependencies": {
"@capacitor/android": "3.0.0-beta.2",
"@capacitor/cli": "3.0.0-beta.2",
"@capacitor/docgen": "^0.0.10",
"@capacitor/ios": "3.0.0-beta.2",
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^1.0.1",
"@ionic/swiftlint-config": "^1.1.2",
"eslint": "^7.11.0",
"np": "^7.4.0",
"prettier": "~2.2.0",
"prettier-plugin-java": "~1.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.32.0",
"swiftlint": "^1.0.1",
"typescript": "~4.0.3"
},
"dependencies": {
"@capacitor/core": "^2.0.0"
"@capacitor/core": "3.0.0-beta.2"
},
"prettier": "@ionic/prettier-config",
"swiftlint": "@ionic/swiftlint-config",
"devDependencies": {
"@capacitor/android": "^2.0.0",
"@capacitor/ios": "^2.0.0",
"@ionic/prettier-config": "^1.0.0",
"@ionic/swiftlint-config": "^1.0.2",
"husky": "^4.2.5",
"np": "^6.2.4",
"prettier": "^2.0.5",
"prettier-plugin-java": "^0.8.0",
"pretty-quick": "^2.0.1",
"rimraf": "^3.0.0",
"swiftlint": "^1.0.1",
"typescript": "^3.2.4"
"eslintConfig": {
"extends": "@ionic/eslint-config/recommended"
},
"husky": {
"hooks": {
"pre-commit": "npm run lint"
}
},
"files": [
"dist/",
"ios/",
"android/",
"CapacitorCommunityFacebookLogin.podspec"
],
"keywords": [

@@ -62,10 +79,3 @@ "capacitor",

}
},
"repository": {
"type": "git",
"url": "git@github.com:capacitor-community/facebook-login.git"
},
"bugs": {
"url": "git@github.com:capacitor-community/facebook-login.git/issues"
}
}

@@ -6,2 +6,5 @@ [![npm version](https://badge.fury.io/js/%40capacitor-community%2Ffacebook-login.svg)](https://badge.fury.io/js/%40capacitor-community%2Ffacebook-login)

# ✅ Please check
This is development README for Capacitor v3. If you use v1 or v2, please check [./README_v2.md](README_v2.md)
# capacitor-facebook-login

@@ -24,19 +27,6 @@ Capacitory community plugin for Facebook Login.

```bash
% npm i --save @capacitor-community/facebook-login
% npm i --save @capacitor-community/facebook-login@next
% npx cap update
```
To use yarn
```bash
% yarn add @capacitor-community/facebook-login
% npx cap update
```
### If you use Capacitor 1.x
```
% npm install --save @rdlabo/capacitor-facebook-login@1.5.0
% npx cap update
```
## Android configuration

@@ -47,7 +37,15 @@

```java
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
[...]
add(com.getcapacitor.community.facebooklogin.FacebookLogin.class);
[...]
}});
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initializes the Bridge
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
// Additional plugins you've installed go here
// Ex: add(TotallyAwesomePlugin.class);
add(com.getcapacitor.community.facebooklogin.FacebookLogin.class);
}});
}
}
```

@@ -97,18 +95,38 @@

```swift
import FacebookCore
import UIKit
import Capacitor
import FBSDKCoreKit
[...]
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FBSDKCoreKit.ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if CAPBridge.handleOpenUrl(url, options) {
return FBSDKCoreKit.ApplicationDelegate.shared.application(app, open: url, options: options)
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FBSDKCoreKit.ApplicationDelegate.shared.application(
application,
didFinishLaunchingWithOptions: launchOptions
)
return true
}
else{
return false
...
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
// Called when the app was launched with a url. Feel free to add additional processing here,
// but if you want the App API to support tracking app url opens, make sure to keep this call
if (FBSDKCoreKit.ApplicationDelegate.shared.application(
app,
open: url,
sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
annotation: options[UIApplication.OpenURLOptionsKey.annotation]
)) {
return true;
} else {
return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
}
}
}
}
```

@@ -119,2 +137,3 @@

```xml
<key>CFBundleURLTypes</key>

@@ -132,7 +151,20 @@ <array>

<key>FacebookDisplayName</key>
<string>Wimlov</string>
<string>[DISPLAY_NAME]</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbapi20160328</string>
<string>fbauth</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>

@@ -165,10 +197,2 @@ ```

```ts
// Init Capacitor
import { registerWebPlugin } from '@capacitor/core';
import { FacebookLogin } from '@capacitor-community/facebook-login';
...
registerWebPlugin(FacebookLogin);
```
More information can be found here: https://developers.facebook.com/docs/facebook-login/web

@@ -178,3 +202,2 @@ And you must confirm return type at https://github.com/rdlabo/capacitor-facebook-login/blob/master/src/web.ts#L55-L57

## Supported methods

@@ -194,5 +217,3 @@

```ts
import { Plugins } from '@capacitor/core';
import { FacebookLoginResponse } from '@capacitor-community/facebook-login';
const { FacebookLogin } = Plugins;
import { FacebookLogin, FacebookLoginResponse } from '@capacitor-community/facebook-login';

@@ -213,4 +234,3 @@ const FACEBOOK_PERMISSIONS = ['email', 'user_birthday', 'user_photos', 'user_gender'];

```ts
import { Plugins } from '@capacitor/core';
const { FacebookLogin } = Plugins;
import { FacebookLogin } from '@capacitor-community/facebook-login';

@@ -223,5 +243,3 @@ await FacebookLogin.logout();

```ts
import { Plugins } from '@capacitor/core';
import { FacebookLoginResponse } from '@capacitor-community/facebook-login';
const { FacebookLogin } = Plugins;
import { FacebookLogin, FacebookLoginResponse } from '@capacitor-community/facebook-login';

@@ -240,5 +258,3 @@ const result = await <FacebookLoginResponse>FacebookLogin.getCurrentAccessToken();

```ts
import { Plugins } from '@capacitor/core';
import { FacebookLoginResponse } from '@capacitor-community/facebook-login';
const { FacebookLogin } = Plugins;
import { FacebookLogin, FacebookLoginResponse } from '@capacitor-community/facebook-login';

@@ -245,0 +261,0 @@ const result = await FacebookLogin.getProfile<{

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc