@capgo/capacitor-social-login 0.0.64 → 0.0.65

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/README.md CHANGED
@@ -357,11 +357,11 @@ Refresh the access token
357
357
 
358
358
  #### FacebookLoginResponse
359
359
 
360
- | Prop | Type |
361
- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
362
- | **`accessToken`** | <code><a href="#accesstoken">AccessToken</a> \| null</code> |
363
- | **`profile`** | <code>{ userID: string; email: string \| null; friendIDs: string[]; birthday: string \| null; ageRange: { min?: number; max?: number; } \| null; gender: string \| null; location: { id: string; name: string; } \| null; hometown: { id: string; name: string; } \| null; profileURL: string \| null; name: string \| null; imageURL: string \| null; }</code> |
364
- | **`authenticationToken`** | <code>string \| null</code> |
360
+ | Prop | Type |
361
+ | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
362
+ | **`accessToken`** | <code><a href="#accesstoken">AccessToken</a> \| null</code> |
363
+ | **`idToken`** | <code>string \| null</code> |
364
+ | **`profile`** | <code>{ userID: string; email: string \| null; friendIDs: string[]; birthday: string \| null; ageRange: { min?: number; max?: number; } \| null; gender: string \| null; location: { id: string; name: string; } \| null; hometown: { id: string; name: string; } \| null; profileURL: string \| null; name: string \| null; imageURL: string \| null; }</code> |
365
365
 
366
366
 
367
367
  #### AccessToken
@@ -390,12 +390,11 @@ Refresh the access token
390
390
 
391
391
  #### AppleProviderResponse
392
392
 
393
- | Prop | Type |
394
- | ----------------------- | ------------------------------------------------------------------------------------------------------------ |
395
- | **`accessToken`** | <code><a href="#accesstoken">AccessToken</a> \| null</code> |
396
- | **`profile`** | <code>{ user: string; email: string \| null; givenName: string \| null; familyName: string \| null; }</code> |
397
- | **`idToken`** | <code>string \| null</code> |
398
- | **`authorizationCode`** | <code>string \| null</code> |
393
+ | Prop | Type |
394
+ | ----------------- | ------------------------------------------------------------------------------------------------------------ |
395
+ | **`accessToken`** | <code><a href="#accesstoken">AccessToken</a> \| null</code> |
396
+ | **`idToken`** | <code>string \| null</code> |
397
+ | **`profile`** | <code>{ user: string; email: string \| null; givenName: string \| null; familyName: string \| null; }</code> |
399
398
 
400
399
 
401
400
  #### LoginOptions
@@ -99,7 +99,7 @@ public class FacebookProvider implements SocialProvider {
99
99
  result.put("accessToken", createAccessTokenObject(accessToken));
100
100
  result.put("profile", createProfileObject(accessToken));
101
101
  result.put(
102
- "authenticationToken",
102
+ "idToken",
103
103
  loginResult.getAuthenticationToken() != null
104
104
  ? loginResult.getAuthenticationToken().getToken()
105
105
  : null
package/dist/docs.json CHANGED
@@ -231,18 +231,18 @@
231
231
  "type": "AccessToken | null"
232
232
  },
233
233
  {
234
- "name": "profile",
234
+ "name": "idToken",
235
235
  "tags": [],
236
236
  "docs": "",
237
237
  "complexTypes": [],
238
- "type": "{ userID: string; email: string | null; friendIDs: string[]; birthday: string | null; ageRange: { min?: number | undefined; max?: number | undefined; } | null; gender: string | null; location: { id: string; name: string; } | null; hometown: { id: string; name: string; } | null; profileURL: string | null; name: string | null; imageURL: string | null; }"
238
+ "type": "string | null"
239
239
  },
240
240
  {
241
- "name": "authenticationToken",
241
+ "name": "profile",
242
242
  "tags": [],
243
243
  "docs": "",
244
244
  "complexTypes": [],
245
- "type": "string | null"
245
+ "type": "{ userID: string; email: string | null; friendIDs: string[]; birthday: string | null; ageRange: { min?: number | undefined; max?: number | undefined; } | null; gender: string | null; location: { id: string; name: string; } | null; hometown: { id: string; name: string; } | null; profileURL: string | null; name: string | null; imageURL: string | null; }"
246
246
  }
247
247
  ]
248
248
  },
@@ -366,13 +366,6 @@
366
366
  ],
367
367
  "type": "AccessToken | null"
368
368
  },
369
- {
370
- "name": "profile",
371
- "tags": [],
372
- "docs": "",
373
- "complexTypes": [],
374
- "type": "{ user: string; email: string | null; givenName: string | null; familyName: string | null; }"
375
- },
376
369
  {
377
370
  "name": "idToken",
378
371
  "tags": [],
@@ -381,11 +374,11 @@
381
374
  "type": "string | null"
382
375
  },
383
376
  {
384
- "name": "authorizationCode",
377
+ "name": "profile",
385
378
  "tags": [],
386
379
  "docs": "",
387
380
  "complexTypes": [],
388
- "type": "string | null"
381
+ "type": "{ user: string; email: string | null; givenName: string | null; familyName: string | null; }"
389
382
  }
390
383
  ]
391
384
  },
@@ -116,14 +116,13 @@ export interface AppleProviderOptions {
116
116
  }
117
117
  export interface AppleProviderResponse {
118
118
  accessToken: AccessToken | null;
119
+ idToken: string | null;
119
120
  profile: {
120
121
  user: string;
121
122
  email: string | null;
122
123
  givenName: string | null;
123
124
  familyName: string | null;
124
125
  };
125
- idToken: string | null;
126
- authorizationCode: string | null;
127
126
  }
128
127
  export interface LoginOptions {
129
128
  /**
@@ -162,6 +161,7 @@ export interface AccessToken {
162
161
  }
163
162
  export interface FacebookLoginResponse {
164
163
  accessToken: AccessToken | null;
164
+ idToken: string | null;
165
165
  profile: {
166
166
  userID: string;
167
167
  email: string | null;
@@ -184,7 +184,6 @@ export interface FacebookLoginResponse {
184
184
  name: string | null;
185
185
  imageURL: string | null;
186
186
  };
187
- authenticationToken: string | null;
188
187
  }
189
188
  export interface AuthorizationCode {
190
189
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface InitializeOptions {\n facebook?: {\n /**\n * Facebook App ID, provided by Facebook for web, in mobile it's set in the native files\n */\n appId: string;\n /**\n * Facebook Client Token, provided by Facebook for web, in mobile it's set in the native files\n */\n clientToken: string;\n };\n\n google?: {\n /**\n * The app's client ID, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSClientId?: string;\n /**\n * The app's server client ID, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSServerClientId?: string;\n /**\n * The app's web client ID, found and created in the Google Developers Console.\n * For Android (and web in the future).\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n webClientId?: string;\n };\n apple?: {\n /**\n * Apple Client ID, provided by Apple for web and Android\n */\n clientId?: string;\n /**\n * Apple Redirect URL, should be your backend url that is configured in your apple app, only for android\n */\n redirectUrl?: string;\n };\n}\n\nexport interface FacebookLoginOptions {\n /**\n * Permissions\n * @description select permissions to login with\n */\n permissions: string[];\n /**\n * Is Limited Login\n * @description use limited login for Facebook IOS\n * @default false\n */\n limitedLogin?: boolean;\n /**\n * Nonce\n * @description A custom nonce to use for the login request\n */\n nonce?: string;\n}\n\nexport interface GoogleLoginOptions {\n /**\n * Specifies the scopes required for accessing Google APIs\n * The default is defined in the configuration.\n * @example [\"profile\", \"email\"]\n * @see [Google OAuth2 Scopes](https://developers.google.com/identity/protocols/oauth2/scopes)\n */\n scopes?: string[];\n /**\n * Nonce\n * @description nonce\n */\n nonce?: string;\n /**\n * Set if your application needs to refresh access tokens when the user is not present at the browser.\n * In response use `serverAuthCode` key\n *\n * @default false\n * @since 3.1.0\n * */\n grantOfflineAccess?: boolean;\n}\n\nexport interface GoogleLoginResponse {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n email: string | null;\n familyName: string | null;\n givenName: string | null;\n id: string | null;\n name: string | null;\n imageUrl: string | null;\n };\n}\n\nexport interface AppleProviderOptions {\n /**\n * Scopes\n * @description An array of scopes to request during login\n * @example [\"name\", \"email\"]\n * default: [\"name\", \"email\"]\n */\n scopes?: string[];\n /**\n * Nonce\n * @description nonce\n */\n nonce?: string;\n /**\n * State\n * @description state\n */\n state?: string;\n}\n\nexport interface AppleProviderResponse {\n accessToken: AccessToken | null;\n profile: {\n user: string;\n email: string | null;\n givenName: string | null;\n familyName: string | null;\n };\n idToken: string | null;\n authorizationCode: string | null;\n}\n\nexport interface LoginOptions {\n /**\n * Provider\n * @description select provider to login with\n */\n provider: \"facebook\" | \"google\" | \"apple\" | \"twitter\";\n /**\n * Options\n * @description payload to login with\n */\n options: FacebookLoginOptions | GoogleLoginOptions | AppleProviderOptions;\n}\n\nexport interface LoginResult {\n /**\n * Provider\n * @description select provider to login with\n */\n provider: \"facebook\" | \"google\" | \"apple\" | \"twitter\";\n /**\n * Payload\n * @description payload to login with\n */\n result: FacebookLoginResponse | GoogleLoginResponse | AppleProviderResponse;\n}\n\nexport interface AccessToken {\n applicationId?: string;\n declinedPermissions?: string[];\n expires?: string;\n isExpired?: boolean;\n lastRefresh?: string;\n permissions?: string[];\n token: string;\n refreshToken?: string;\n userId?: string;\n}\n\nexport interface FacebookLoginResponse {\n accessToken: AccessToken | null;\n profile: {\n userID: string;\n email: string | null;\n friendIDs: string[];\n birthday: string | null;\n ageRange: { min?: number; max?: number } | null;\n gender: string | null;\n location: { id: string; name: string } | null;\n hometown: { id: string; name: string } | null;\n profileURL: string | null;\n name: string | null;\n imageURL: string | null;\n };\n authenticationToken: string | null;\n}\n\nexport interface AuthorizationCode {\n /**\n * Jwt\n * @description A JSON web token\n */\n jwt: string;\n}\n\nexport interface AuthorizationCodeOptions {\n /**\n * Provider\n * @description Provider for the authorization code\n */\n provider: \"apple\" | \"google\" | \"facebook\";\n}\n\nexport interface isLoggedInOptions {\n /**\n * Provider\n * @description Provider for the isLoggedIn\n */\n provider: \"apple\" | \"google\" | \"facebook\";\n}\n\nexport interface SocialLoginPlugin {\n /**\n * Initialize the plugin\n * @description initialize the plugin with the required options\n */\n initialize(options: InitializeOptions): Promise<void>;\n /**\n * Login with the selected provider\n * @description login with the selected provider\n */\n login(options: LoginOptions): Promise<LoginResult>;\n /**\n * Logout\n * @description logout the user\n */\n logout(options: { provider: \"apple\" | \"google\" | \"facebook\" }): Promise<void>;\n /**\n * IsLoggedIn\n * @description logout the user\n */\n isLoggedIn(options: isLoggedInOptions): Promise<{ isLoggedIn: boolean }>;\n\n /**\n * Get the current access token\n * @description get the current access token\n */\n getAuthorizationCode(\n options: AuthorizationCodeOptions,\n ): Promise<AuthorizationCode>;\n /**\n * Refresh the access token\n * @description refresh the access token\n */\n refresh(options: LoginOptions): Promise<void>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface InitializeOptions {\n facebook?: {\n /**\n * Facebook App ID, provided by Facebook for web, in mobile it's set in the native files\n */\n appId: string;\n /**\n * Facebook Client Token, provided by Facebook for web, in mobile it's set in the native files\n */\n clientToken: string;\n };\n\n google?: {\n /**\n * The app's client ID, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSClientId?: string;\n /**\n * The app's server client ID, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSServerClientId?: string;\n /**\n * The app's web client ID, found and created in the Google Developers Console.\n * For Android (and web in the future).\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n webClientId?: string;\n };\n apple?: {\n /**\n * Apple Client ID, provided by Apple for web and Android\n */\n clientId?: string;\n /**\n * Apple Redirect URL, should be your backend url that is configured in your apple app, only for android\n */\n redirectUrl?: string;\n };\n}\n\nexport interface FacebookLoginOptions {\n /**\n * Permissions\n * @description select permissions to login with\n */\n permissions: string[];\n /**\n * Is Limited Login\n * @description use limited login for Facebook IOS\n * @default false\n */\n limitedLogin?: boolean;\n /**\n * Nonce\n * @description A custom nonce to use for the login request\n */\n nonce?: string;\n}\n\nexport interface GoogleLoginOptions {\n /**\n * Specifies the scopes required for accessing Google APIs\n * The default is defined in the configuration.\n * @example [\"profile\", \"email\"]\n * @see [Google OAuth2 Scopes](https://developers.google.com/identity/protocols/oauth2/scopes)\n */\n scopes?: string[];\n /**\n * Nonce\n * @description nonce\n */\n nonce?: string;\n /**\n * Set if your application needs to refresh access tokens when the user is not present at the browser.\n * In response use `serverAuthCode` key\n *\n * @default false\n * @since 3.1.0\n * */\n grantOfflineAccess?: boolean;\n}\n\nexport interface GoogleLoginResponse {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n email: string | null;\n familyName: string | null;\n givenName: string | null;\n id: string | null;\n name: string | null;\n imageUrl: string | null;\n };\n}\n\nexport interface AppleProviderOptions {\n /**\n * Scopes\n * @description An array of scopes to request during login\n * @example [\"name\", \"email\"]\n * default: [\"name\", \"email\"]\n */\n scopes?: string[];\n /**\n * Nonce\n * @description nonce\n */\n nonce?: string;\n /**\n * State\n * @description state\n */\n state?: string;\n}\n\nexport interface AppleProviderResponse {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n user: string;\n email: string | null;\n givenName: string | null;\n familyName: string | null;\n };\n}\n\nexport interface LoginOptions {\n /**\n * Provider\n * @description select provider to login with\n */\n provider: \"facebook\" | \"google\" | \"apple\" | \"twitter\";\n /**\n * Options\n * @description payload to login with\n */\n options: FacebookLoginOptions | GoogleLoginOptions | AppleProviderOptions;\n}\n\nexport interface LoginResult {\n /**\n * Provider\n * @description select provider to login with\n */\n provider: \"facebook\" | \"google\" | \"apple\" | \"twitter\";\n /**\n * Payload\n * @description payload to login with\n */\n result: FacebookLoginResponse | GoogleLoginResponse | AppleProviderResponse;\n}\n\nexport interface AccessToken {\n applicationId?: string;\n declinedPermissions?: string[];\n expires?: string;\n isExpired?: boolean;\n lastRefresh?: string;\n permissions?: string[];\n token: string;\n refreshToken?: string;\n userId?: string;\n}\n\nexport interface FacebookLoginResponse {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n userID: string;\n email: string | null;\n friendIDs: string[];\n birthday: string | null;\n ageRange: { min?: number; max?: number } | null;\n gender: string | null;\n location: { id: string; name: string } | null;\n hometown: { id: string; name: string } | null;\n profileURL: string | null;\n name: string | null;\n imageURL: string | null;\n };\n}\n\nexport interface AuthorizationCode {\n /**\n * Jwt\n * @description A JSON web token\n */\n jwt: string;\n}\n\nexport interface AuthorizationCodeOptions {\n /**\n * Provider\n * @description Provider for the authorization code\n */\n provider: \"apple\" | \"google\" | \"facebook\";\n}\n\nexport interface isLoggedInOptions {\n /**\n * Provider\n * @description Provider for the isLoggedIn\n */\n provider: \"apple\" | \"google\" | \"facebook\";\n}\n\nexport interface SocialLoginPlugin {\n /**\n * Initialize the plugin\n * @description initialize the plugin with the required options\n */\n initialize(options: InitializeOptions): Promise<void>;\n /**\n * Login with the selected provider\n * @description login with the selected provider\n */\n login(options: LoginOptions): Promise<LoginResult>;\n /**\n * Logout\n * @description logout the user\n */\n logout(options: { provider: \"apple\" | \"google\" | \"facebook\" }): Promise<void>;\n /**\n * IsLoggedIn\n * @description logout the user\n */\n isLoggedIn(options: isLoggedInOptions): Promise<{ isLoggedIn: boolean }>;\n\n /**\n * Get the current access token\n * @description get the current access token\n */\n getAuthorizationCode(\n options: AuthorizationCodeOptions,\n ): Promise<AuthorizationCode>;\n /**\n * Refresh the access token\n * @description refresh the access token\n */\n refresh(options: LoginOptions): Promise<void>;\n}\n"]}
package/dist/esm/web.js CHANGED
@@ -235,10 +235,9 @@ export class SocialLoginWeb extends WebPlugin {
235
235
  familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,
236
236
  },
237
237
  accessToken: {
238
- token: "", // TODO: to fix and find the correct token
238
+ token: res.authorization.code, // TODO: to fix and find the correct token
239
239
  },
240
240
  idToken: res.authorization.id_token || null,
241
- authorizationCode: res.authorization.code || null,
242
241
  };
243
242
  resolve({ provider: "apple", result });
244
243
  })
@@ -320,7 +319,7 @@ export class SocialLoginWeb extends WebPlugin {
320
319
  hometown: null,
321
320
  profileURL: null,
322
321
  },
323
- authenticationToken: null,
322
+ idToken: null,
324
323
  };
325
324
  resolve({ provider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AI,IAAI;gCAC1B,QAAQ,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI;6BAClC;yBACF,CAAC;wBACF,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;oBAC1C,CAAC;gBACH,CAAC;aACF,CAAC,CAAC;YACH,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n SocialLoginPlugin,\n InitializeOptions,\n LoginOptions,\n LoginResult,\n AuthorizationCode,\n GoogleLoginResponse,\n AppleProviderResponse,\n isLoggedInOptions,\n AuthorizationCodeOptions,\n FacebookLoginOptions,\n FacebookLoginResponse,\n} from \"./definitions\";\n\n// Add this declaration at the top of the file\ndeclare const google: {\n accounts: {\n id: {\n initialize(config: {\n client_id: string;\n callback: (response: any) => void;\n auto_select?: boolean;\n }): void;\n prompt(callback: (notification: any) => void): void;\n };\n oauth2: {\n initTokenClient(config: {\n client_id: string;\n callback: (response: any) => void;\n auto_select?: boolean;\n scope: string\n }): {\n requestAccessToken(): void;\n };\n }\n };\n};\n\ndeclare const AppleID: any;\n\ndeclare const FB: {\n init(options: any): void;\n login(\n callback: (response: {\n status: string;\n authResponse: { accessToken: string; userID: string };\n }) => void,\n options?: { scope: string },\n ): void;\n logout(callback: () => void): void;\n api(\n path: string,\n params: { fields: string },\n callback: (response: any) => void,\n ): void;\n getLoginStatus(\n callback: (response: {\n status: string;\n authResponse?: { accessToken: string };\n }) => void,\n ): void;\n};\n\nexport class SocialLoginWeb extends WebPlugin implements SocialLoginPlugin {\n private googleClientId: string | null = null;\n private appleClientId: string | null = null;\n private googleScriptLoaded = false;\n private appleScriptLoaded = false;\n private appleScriptUrl =\n \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n private facebookAppId: string | null = null;\n private facebookScriptLoaded = false;\n\n async initialize(options: InitializeOptions): Promise<void> {\n if (options.google?.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if (options.apple?.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n if (options.facebook?.appId) {\n this.facebookAppId = options.facebook.appId;\n await this.loadFacebookScript();\n FB.init({\n appId: this.facebookAppId,\n version: \"v17.0\",\n xfbml: true,\n cookie: true,\n });\n }\n // Implement initialization for other providers if needed\n }\n\n async login(options: LoginOptions): Promise<LoginResult> {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n } else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n } else if (options.provider === \"facebook\") {\n return this.loginWithFacebook(options.options as FacebookLoginOptions);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n\n async logout(options: {\n provider: \"apple\" | \"google\" | \"facebook\";\n }): Promise<void> {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\n \"Google logout: Token should be revoked on the client side if stored\",\n );\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\n \"Apple logout: Session should be managed on the client side\",\n );\n break;\n case \"facebook\":\n return new Promise<void>((resolve) => {\n FB.logout(() => resolve());\n });\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n\n async isLoggedIn(\n options: isLoggedInOptions,\n ): Promise<{ isLoggedIn: boolean }> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === \"connected\" });\n });\n });\n default:\n throw new Error(\n `isLoggedIn for ${options.provider} is not implemented`,\n );\n }\n }\n\n async getAuthorizationCode(\n options: AuthorizationCodeOptions,\n ): Promise<AuthorizationCode> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n if (response.status === \"connected\") {\n resolve({ jwt: response.authResponse?.accessToken || \"\" });\n } else {\n reject(new Error(\"No Facebook authorization code available\"));\n }\n });\n });\n default:\n throw new Error(\n `getAuthorizationCode for ${options.provider} is not implemented`,\n );\n }\n }\n\n async refresh(options: LoginOptions): Promise<void> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n await this.loginWithFacebook(options.options as FacebookLoginOptions);\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n\n private async loginWithGoogle(options: any): Promise<LoginResult> {\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n\n const scopes = options.scopes || [\"email\", \"profile\"];\n\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n return this.fallbackToTraditionalOAuth(scopes);\n }\n\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId!,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n } else {\n const payload = this.parseJwt(response.credential);\n const result: GoogleLoginResponse = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n auto_select: true\n });\n\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n // Fallback to traditional OAuth if One Tap is not available\n this.fallbackToTraditionalOAuth(scopes).then(resolve).catch(reject);\n } else {\n console.log(\"OneTap is displayed\");\n }\n });\n });\n }\n\n private parseJwt(token: string) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"),\n );\n return JSON.parse(jsonPayload);\n }\n\n private async loadGoogleScript(): Promise<void> {\n if (this.googleScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async loginWithApple(options: any): Promise<LoginResult> {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n\n return new Promise((resolve, reject) => {\n AppleID.auth.init({\n clientId: this.appleClientId!,\n scope: options.scopes?.join(\" \") || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n\n AppleID.auth\n .signIn()\n .then((res: any) => {\n const result: AppleProviderResponse = {\n profile: {\n user: res.user?.name?.firstName\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : \"\",\n email: res.user?.email || null,\n givenName: res.user?.name?.firstName || null,\n familyName: res.user?.name?.lastName || null,\n },\n accessToken: {\n token: \"\", // TODO: to fix and find the correct token\n },\n idToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error: any) => {\n reject(error);\n });\n });\n }\n\n private async loadAppleScript(): Promise<void> {\n if (this.appleScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async getGoogleUser(): Promise<any> {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId!,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n\n private async loadFacebookScript(): Promise<void> {\n if (this.facebookScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://connect.facebook.net/en_US/sdk.js\";\n script.async = true;\n script.defer = true;\n script.onload = () => {\n this.facebookScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async loginWithFacebook(\n options: FacebookLoginOptions,\n ): Promise<LoginResult> {\n if (!this.facebookAppId) {\n throw new Error(\"Facebook App ID not set. Call initialize() first.\");\n }\n\n return new Promise((resolve, reject) => {\n FB.login(\n (response) => {\n if (response.status === \"connected\") {\n FB.api(\n \"/me\",\n { fields: \"id,name,email,picture\" },\n (userInfo: any) => {\n const result: FacebookLoginResponse = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: userInfo.picture?.data?.url || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n authenticationToken: null,\n };\n resolve({ provider: \"facebook\", result });\n },\n );\n } else {\n reject(new Error(\"Facebook login failed\"));\n }\n },\n { scope: options.permissions.join(\",\") },\n );\n });\n }\n\n private async fallbackToTraditionalOAuth(scopes: string[]): Promise<LoginResult> {\n return new Promise((resolve, reject) => {\n const auth2 = google.accounts.oauth2.initTokenClient({\n client_id: this.googleClientId!,\n scope: scopes.join(' '),\n callback: (response) => {\n if (response.error) {\n reject(response.error);\n } else {\n // Process the response similar to One Tap\n const payload = this.parseJwt(response.access_token);\n const result: GoogleLoginResponse = {\n accessToken: {\n token: response.access_token\n },\n idToken: null, // Traditional OAuth doesn't provide id_token by default\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n auth2.requestAccessToken();\n });\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAiE5C,MAAM,OAAO,cAAe,SAAQ,SAAS;IAA7C;;QACU,mBAAc,GAAkB,IAAI,CAAC;QACrC,kBAAa,GAAkB,IAAI,CAAC;QACpC,uBAAkB,GAAG,KAAK,CAAC;QAC3B,sBAAiB,GAAG,KAAK,CAAC;QAC1B,mBAAc,GACpB,sFAAsF,CAAC;QACjF,kBAAa,GAAkB,IAAI,CAAC;QACpC,yBAAoB,GAAG,KAAK,CAAC;IAsYvC,CAAC;IApYC,KAAK,CAAC,UAAU,CAAC,OAA0B;;QACzC,IAAI,MAAA,OAAO,CAAC,MAAM,0CAAE,WAAW,EAAE,CAAC;YAChC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;YACjD,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAChC,CAAC;QACD,IAAI,MAAA,OAAO,CAAC,KAAK,0CAAE,QAAQ,EAAE,CAAC;YAC5B,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AAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;wBACrD,MAAM,MAAM,GAAwB;4BAClC,WAAW,EAAE;gCACX,KAAK,EAAE,QAAQ,CAAC,YAAY;6BAC7B;4BACD,OAAO,EAAE,IAAI,EAAE,wDAAwD;4BACvE,OAAO,EAAE;gCACP,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI;gCAC5B,UAAU,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;gCACvC,SAAS,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;gCACrC,EAAE,EAAE,OAAO,CAAC,GAAG,IAAI,IAAI;gCACvB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;gCAC1B,QAAQ,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI;6BAClC;yBACF,CAAC;wBACF,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;oBAC1C,CAAC;gBACH,CAAC;aACF,CAAC,CAAC;YACH,KAAK,CAAC,kBAAkB,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n SocialLoginPlugin,\n InitializeOptions,\n LoginOptions,\n LoginResult,\n AuthorizationCode,\n GoogleLoginResponse,\n AppleProviderResponse,\n isLoggedInOptions,\n AuthorizationCodeOptions,\n FacebookLoginOptions,\n FacebookLoginResponse,\n} from \"./definitions\";\n\n// Add this declaration at the top of the file\ndeclare const google: {\n accounts: {\n id: {\n initialize(config: {\n client_id: string;\n callback: (response: any) => void;\n auto_select?: boolean;\n }): void;\n prompt(callback: (notification: any) => void): void;\n };\n oauth2: {\n initTokenClient(config: {\n client_id: string;\n callback: (response: any) => void;\n auto_select?: boolean;\n scope: string\n }): {\n requestAccessToken(): void;\n };\n }\n };\n};\n\ndeclare const AppleID: any;\n\ndeclare const FB: {\n init(options: any): void;\n login(\n callback: (response: {\n status: string;\n authResponse: { accessToken: string; userID: string };\n }) => void,\n options?: { scope: string },\n ): void;\n logout(callback: () => void): void;\n api(\n path: string,\n params: { fields: string },\n callback: (response: any) => void,\n ): void;\n getLoginStatus(\n callback: (response: {\n status: string;\n authResponse?: { accessToken: string };\n }) => void,\n ): void;\n};\n\nexport class SocialLoginWeb extends WebPlugin implements SocialLoginPlugin {\n private googleClientId: string | null = null;\n private appleClientId: string | null = null;\n private googleScriptLoaded = false;\n private appleScriptLoaded = false;\n private appleScriptUrl =\n \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n private facebookAppId: string | null = null;\n private facebookScriptLoaded = false;\n\n async initialize(options: InitializeOptions): Promise<void> {\n if (options.google?.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if (options.apple?.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n if (options.facebook?.appId) {\n this.facebookAppId = options.facebook.appId;\n await this.loadFacebookScript();\n FB.init({\n appId: this.facebookAppId,\n version: \"v17.0\",\n xfbml: true,\n cookie: true,\n });\n }\n // Implement initialization for other providers if needed\n }\n\n async login(options: LoginOptions): Promise<LoginResult> {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n } else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n } else if (options.provider === \"facebook\") {\n return this.loginWithFacebook(options.options as FacebookLoginOptions);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n\n async logout(options: {\n provider: \"apple\" | \"google\" | \"facebook\";\n }): Promise<void> {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\n \"Google logout: Token should be revoked on the client side if stored\",\n );\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\n \"Apple logout: Session should be managed on the client side\",\n );\n break;\n case \"facebook\":\n return new Promise<void>((resolve) => {\n FB.logout(() => resolve());\n });\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n\n async isLoggedIn(\n options: isLoggedInOptions,\n ): Promise<{ isLoggedIn: boolean }> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === \"connected\" });\n });\n });\n default:\n throw new Error(\n `isLoggedIn for ${options.provider} is not implemented`,\n );\n }\n }\n\n async getAuthorizationCode(\n options: AuthorizationCodeOptions,\n ): Promise<AuthorizationCode> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n if (response.status === \"connected\") {\n resolve({ jwt: response.authResponse?.accessToken || \"\" });\n } else {\n reject(new Error(\"No Facebook authorization code available\"));\n }\n });\n });\n default:\n throw new Error(\n `getAuthorizationCode for ${options.provider} is not implemented`,\n );\n }\n }\n\n async refresh(options: LoginOptions): Promise<void> {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n await this.loginWithFacebook(options.options as FacebookLoginOptions);\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n\n private async loginWithGoogle(options: any): Promise<LoginResult> {\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n\n const scopes = options.scopes || [\"email\", \"profile\"];\n\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n return this.fallbackToTraditionalOAuth(scopes);\n }\n\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId!,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n } else {\n const payload = this.parseJwt(response.credential);\n const result: GoogleLoginResponse = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n auto_select: true\n });\n\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n // Fallback to traditional OAuth if One Tap is not available\n this.fallbackToTraditionalOAuth(scopes).then(resolve).catch(reject);\n } else {\n console.log(\"OneTap is displayed\");\n }\n });\n });\n }\n\n private parseJwt(token: string) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(\n atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"),\n );\n return JSON.parse(jsonPayload);\n }\n\n private async loadGoogleScript(): Promise<void> {\n if (this.googleScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async loginWithApple(options: any): Promise<LoginResult> {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n\n return new Promise((resolve, reject) => {\n AppleID.auth.init({\n clientId: this.appleClientId!,\n scope: options.scopes?.join(\" \") || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n\n AppleID.auth\n .signIn()\n .then((res: any) => {\n const result: AppleProviderResponse = {\n profile: {\n user: res.user?.name?.firstName\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : \"\",\n email: res.user?.email || null,\n givenName: res.user?.name?.firstName || null,\n familyName: res.user?.name?.lastName || null,\n },\n accessToken: {\n token: res.authorization.code , // TODO: to fix and find the correct token\n },\n idToken: res.authorization.id_token || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error: any) => {\n reject(error);\n });\n });\n }\n\n private async loadAppleScript(): Promise<void> {\n if (this.appleScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async getGoogleUser(): Promise<any> {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId!,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n\n private async loadFacebookScript(): Promise<void> {\n if (this.facebookScriptLoaded) return;\n\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://connect.facebook.net/en_US/sdk.js\";\n script.async = true;\n script.defer = true;\n script.onload = () => {\n this.facebookScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n\n private async loginWithFacebook(\n options: FacebookLoginOptions,\n ): Promise<LoginResult> {\n if (!this.facebookAppId) {\n throw new Error(\"Facebook App ID not set. Call initialize() first.\");\n }\n\n return new Promise((resolve, reject) => {\n FB.login(\n (response) => {\n if (response.status === \"connected\") {\n FB.api(\n \"/me\",\n { fields: \"id,name,email,picture\" },\n (userInfo: any) => {\n const result: FacebookLoginResponse = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: userInfo.picture?.data?.url || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n idToken: null,\n };\n resolve({ provider: \"facebook\", result });\n },\n );\n } else {\n reject(new Error(\"Facebook login failed\"));\n }\n },\n { scope: options.permissions.join(\",\") },\n );\n });\n }\n\n private async fallbackToTraditionalOAuth(scopes: string[]): Promise<LoginResult> {\n return new Promise((resolve, reject) => {\n const auth2 = google.accounts.oauth2.initTokenClient({\n client_id: this.googleClientId!,\n scope: scopes.join(' '),\n callback: (response) => {\n if (response.error) {\n reject(response.error);\n } else {\n // Process the response similar to One Tap\n const payload = this.parseJwt(response.access_token);\n const result: GoogleLoginResponse = {\n accessToken: {\n token: response.access_token\n },\n idToken: null, // Traditional OAuth doesn't provide id_token by default\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n auth2.requestAccessToken();\n });\n }\n}\n"]}
@@ -242,10 +242,9 @@ class SocialLoginWeb extends core.WebPlugin {
242
242
  familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,
243
243
  },
244
244
  accessToken: {
245
- token: "", // TODO: to fix and find the correct token
245
+ token: res.authorization.code, // TODO: to fix and find the correct token
246
246
  },
247
247
  idToken: res.authorization.id_token || null,
248
- authorizationCode: res.authorization.code || null,
249
248
  };
250
249
  resolve({ provider: "apple", result });
251
250
  })
@@ -327,7 +326,7 @@ class SocialLoginWeb extends core.WebPlugin {
327
326
  hometown: null,
328
327
  profileURL: null,
329
328
  },
330
- authenticationToken: null,
329
+ idToken: null,
331
330
  };
332
331
  resolve({ provider: "facebook", result });
333
332
  });
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.appleClientId = null;\n this.googleScriptLoaded = false;\n this.appleScriptLoaded = false;\n this.appleScriptUrl = \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n this.facebookAppId = null;\n this.facebookScriptLoaded = false;\n }\n async initialize(options) {\n var _a, _b, _c;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n this.facebookAppId = options.facebook.appId;\n await this.loadFacebookScript();\n FB.init({\n appId: this.facebookAppId,\n version: \"v17.0\",\n xfbml: true,\n cookie: true,\n });\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n }\n else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n }\n else if (options.provider === \"facebook\") {\n return this.loginWithFacebook(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\"Google logout: Token should be revoked on the client side if stored\");\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\"Apple logout: Session should be managed on the client side\");\n break;\n case \"facebook\":\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n async isLoggedIn(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === \"connected\" });\n });\n });\n default:\n throw new Error(`isLoggedIn for ${options.provider} is not implemented`);\n }\n }\n async getAuthorizationCode(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === \"connected\") {\n resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || \"\" });\n }\n else {\n reject(new Error(\"No Facebook authorization code available\"));\n }\n });\n });\n default:\n throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);\n }\n }\n async refresh(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n await this.loginWithFacebook(options.options);\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async loginWithGoogle(options) {\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n const scopes = options.scopes || [\"email\", \"profile\"];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n return this.fallbackToTraditionalOAuth(scopes);\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n auto_select: true\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n // Fallback to traditional OAuth if One Tap is not available\n this.fallbackToTraditionalOAuth(scopes).then(resolve).catch(reject);\n }\n else {\n console.log(\"OneTap is displayed\");\n }\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithApple(options) {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n return new Promise((resolve, reject) => {\n var _a;\n AppleID.auth.init({\n clientId: this.appleClientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(\" \")) || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e, _f, _g;\n const result = {\n profile: {\n user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName)\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : \"\",\n email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,\n givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,\n familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,\n },\n accessToken: {\n token: \"\", // TODO: to fix and find the correct token\n },\n idToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async loadAppleScript() {\n if (this.appleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async getGoogleUser() {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n async loadFacebookScript() {\n if (this.facebookScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://connect.facebook.net/en_US/sdk.js\";\n script.async = true;\n script.defer = true;\n script.onload = () => {\n this.facebookScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithFacebook(options) {\n if (!this.facebookAppId) {\n throw new Error(\"Facebook App ID not set. Call initialize() first.\");\n }\n return new Promise((resolve, reject) => {\n FB.login((response) => {\n if (response.status === \"connected\") {\n FB.api(\"/me\", { fields: \"id,name,email,picture\" }, (userInfo) => {\n var _a, _b;\n const result = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n authenticationToken: null,\n };\n resolve({ provider: \"facebook\", result });\n });\n }\n else {\n reject(new Error(\"Facebook login failed\"));\n }\n }, { scope: options.permissions.join(\",\") });\n });\n }\n async fallbackToTraditionalOAuth(scopes) {\n return new Promise((resolve, reject) => {\n const auth2 = google.accounts.oauth2.initTokenClient({\n client_id: this.googleClientId,\n scope: scopes.join(' '),\n callback: (response) => {\n if (response.error) {\n reject(response.error);\n }\n else {\n // Process the response similar to One Tap\n const payload = this.parseJwt(response.access_token);\n const result = {\n accessToken: {\n token: response.access_token\n },\n idToken: null, // Traditional OAuth doesn't provide id_token by default\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n auth2.requestAccessToken();\n });\n }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B,QAAQ,EAAE,CAAC,QAAQ,KAAK;AACxC,oBAAoB,IAAI,QAAQ,CAAC,KAAK,EAAE;AACxC,wBAAwB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/C,qBAAqB;AACrB,yBAAyB;AACzB;AACA,wBAAwB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAC7E,wBAAwB,MAAM,MAAM,GAAG;AACvC,4BAA4B,WAAW,EAAE;AACzC,gCAAgC,KAAK,EAAE,QAAQ,CAAC,YAAY;AAC5D,6BAA6B;AAC7B,4BAA4B,OAAO,EAAE,IAAI;AACzC,4BAA4B,OAAO,EAAE;AACrC,gCAAgC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI;AAC5D,gCAAgC,UAAU,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;AACvE,gCAAgC,SAAS,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;AACrE,gCAAgC,EAAE,EAAE,OAAO,CAAC,GAAG,IAAI,IAAI;AACvD,gCAAgC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;AAC1D,gCAAgC,QAAQ,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI;AACjE,6BAA6B;AAC7B,yBAAyB,CAAC;AAC1B,wBAAwB,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAChE,qBAAqB;AACrB,iBAAiB;AACjB,aAAa,CAAC,CAAC;AACf,YAAY,KAAK,CAAC,kBAAkB,EAAE,CAAC;AACvC,SAAS,CAAC,CAAC;AACX,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.appleClientId = null;\n this.googleScriptLoaded = false;\n this.appleScriptLoaded = false;\n this.appleScriptUrl = \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n this.facebookAppId = null;\n this.facebookScriptLoaded = false;\n }\n async initialize(options) {\n var _a, _b, _c;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n this.facebookAppId = options.facebook.appId;\n await this.loadFacebookScript();\n FB.init({\n appId: this.facebookAppId,\n version: \"v17.0\",\n xfbml: true,\n cookie: true,\n });\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n }\n else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n }\n else if (options.provider === \"facebook\") {\n return this.loginWithFacebook(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\"Google logout: Token should be revoked on the client side if stored\");\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\"Apple logout: Session should be managed on the client side\");\n break;\n case \"facebook\":\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n async isLoggedIn(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === \"connected\" });\n });\n });\n default:\n throw new Error(`isLoggedIn for ${options.provider} is not implemented`);\n }\n }\n async getAuthorizationCode(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === \"connected\") {\n resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || \"\" });\n }\n else {\n reject(new Error(\"No Facebook authorization code available\"));\n }\n });\n });\n default:\n throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);\n }\n }\n async refresh(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n await this.loginWithFacebook(options.options);\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async loginWithGoogle(options) {\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n const scopes = options.scopes || [\"email\", \"profile\"];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n return this.fallbackToTraditionalOAuth(scopes);\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n auto_select: true\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n // Fallback to traditional OAuth if One Tap is not available\n this.fallbackToTraditionalOAuth(scopes).then(resolve).catch(reject);\n }\n else {\n console.log(\"OneTap is displayed\");\n }\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithApple(options) {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n return new Promise((resolve, reject) => {\n var _a;\n AppleID.auth.init({\n clientId: this.appleClientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(\" \")) || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e, _f, _g;\n const result = {\n profile: {\n user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName)\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : \"\",\n email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,\n givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,\n familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,\n },\n accessToken: {\n token: res.authorization.code, // TODO: to fix and find the correct token\n },\n idToken: res.authorization.id_token || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async loadAppleScript() {\n if (this.appleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async getGoogleUser() {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n async loadFacebookScript() {\n if (this.facebookScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://connect.facebook.net/en_US/sdk.js\";\n script.async = true;\n script.defer = true;\n script.onload = () => {\n this.facebookScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithFacebook(options) {\n if (!this.facebookAppId) {\n throw new Error(\"Facebook App ID not set. Call initialize() first.\");\n }\n return new Promise((resolve, reject) => {\n FB.login((response) => {\n if (response.status === \"connected\") {\n FB.api(\"/me\", { fields: \"id,name,email,picture\" }, (userInfo) => {\n var _a, _b;\n const result = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n idToken: null,\n };\n resolve({ provider: \"facebook\", result });\n });\n }\n else {\n reject(new Error(\"Facebook login failed\"));\n }\n }, { scope: options.permissions.join(\",\") });\n });\n }\n async fallbackToTraditionalOAuth(scopes) {\n return new Promise((resolve, reject) => {\n const auth2 = google.accounts.oauth2.initTokenClient({\n client_id: this.googleClientId,\n scope: scopes.join(' '),\n callback: (response) => {\n if (response.error) {\n reject(response.error);\n }\n else {\n // Process the response similar to One Tap\n const payload = this.parseJwt(response.access_token);\n const result = {\n accessToken: {\n token: response.access_token\n },\n idToken: null, // Traditional OAuth doesn't provide id_token by default\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n auth2.requestAccessToken();\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;AAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;AAClE,CAAC;;ACFM,MAAM,cAAc,SAASC,cAAS,CAAC;AAC9C,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;AAC5B,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;AACnC,QAAQ,IAAI,CAAC,aAAa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O,CAAC,KAAK,IAAI,IAAI;AAC5D,gCAAgC,UAAU,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;AACvE,gCAAgC,SAAS,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;AACrE,gCAAgC,EAAE,EAAE,OAAO,CAAC,GAAG,IAAI,IAAI;AACvD,gCAAgC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;AAC1D,gCAAgC,QAAQ,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI;AACjE,6BAA6B;AAC7B,yBAAyB,CAAC;AAC1B,wBAAwB,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;AAChE,qBAAqB;AACrB,iBAAiB;AACjB,aAAa,CAAC,CAAC;AACf,YAAY,KAAK,CAAC,kBAAkB,EAAE,CAAC;AACvC,SAAS,CAAC,CAAC;AACX,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -241,10 +241,9 @@ var capacitorCapacitorUpdater = (function (exports, core) {
241
241
  familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,
242
242
  },
243
243
  accessToken: {
244
- token: "", // TODO: to fix and find the correct token
244
+ token: res.authorization.code, // TODO: to fix and find the correct token
245
245
  },
246
246
  idToken: res.authorization.id_token || null,
247
- authorizationCode: res.authorization.code || null,
248
247
  };
249
248
  resolve({ provider: "apple", result });
250
249
  })
@@ -326,7 +325,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
326
325
  hometown: null,
327
326
  profileURL: null,
328
327
  },
329
- authenticationToken: null,
328
+ idToken: null,
330
329
  };
331
330
  resolve({ provider: "facebook", result });
332
331
  });
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.appleClientId = null;\n this.googleScriptLoaded = false;\n this.appleScriptLoaded = false;\n this.appleScriptUrl = \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n this.facebookAppId = null;\n this.facebookScriptLoaded = false;\n }\n async initialize(options) {\n var _a, _b, _c;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n this.facebookAppId = options.facebook.appId;\n await this.loadFacebookScript();\n FB.init({\n appId: this.facebookAppId,\n version: \"v17.0\",\n xfbml: true,\n cookie: true,\n });\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n }\n else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n }\n else if (options.provider === \"facebook\") {\n return this.loginWithFacebook(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\"Google logout: Token should be revoked on the client side if stored\");\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\"Apple logout: Session should be managed on the client side\");\n break;\n case \"facebook\":\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n async isLoggedIn(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === \"connected\" });\n });\n });\n default:\n throw new Error(`isLoggedIn for ${options.provider} is not implemented`);\n }\n }\n async getAuthorizationCode(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === \"connected\") {\n resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || \"\" });\n }\n else {\n reject(new Error(\"No Facebook authorization code available\"));\n }\n });\n });\n default:\n throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);\n }\n }\n async refresh(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n await this.loginWithFacebook(options.options);\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async loginWithGoogle(options) {\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n const scopes = options.scopes || [\"email\", \"profile\"];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n return this.fallbackToTraditionalOAuth(scopes);\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n auto_select: true\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n // Fallback to traditional OAuth if One Tap is not available\n this.fallbackToTraditionalOAuth(scopes).then(resolve).catch(reject);\n }\n else {\n console.log(\"OneTap is displayed\");\n }\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithApple(options) {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n return new Promise((resolve, reject) => {\n var _a;\n AppleID.auth.init({\n clientId: this.appleClientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(\" \")) || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e, _f, _g;\n const result = {\n profile: {\n user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName)\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : \"\",\n email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,\n givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,\n familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,\n },\n accessToken: {\n token: \"\", // TODO: to fix and find the correct token\n },\n idToken: res.authorization.id_token || null,\n authorizationCode: res.authorization.code || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async loadAppleScript() {\n if (this.appleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async getGoogleUser() {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n async loadFacebookScript() {\n if (this.facebookScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://connect.facebook.net/en_US/sdk.js\";\n script.async = true;\n script.defer = true;\n script.onload = () => {\n this.facebookScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithFacebook(options) {\n if (!this.facebookAppId) {\n throw new Error(\"Facebook App ID not set. Call initialize() first.\");\n }\n return new Promise((resolve, reject) => {\n FB.login((response) => {\n if (response.status === \"connected\") {\n FB.api(\"/me\", { fields: \"id,name,email,picture\" }, (userInfo) => {\n var _a, _b;\n const result = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n authenticationToken: null,\n };\n resolve({ provider: \"facebook\", result });\n });\n }\n else {\n reject(new Error(\"Facebook login failed\"));\n }\n }, { scope: options.permissions.join(\",\") });\n });\n }\n async fallbackToTraditionalOAuth(scopes) {\n return new Promise((resolve, reject) => {\n const auth2 = google.accounts.oauth2.initTokenClient({\n client_id: this.googleClientId,\n scope: scopes.join(' '),\n callback: (response) => {\n if (response.error) {\n reject(response.error);\n }\n else {\n // Process the response similar to One Tap\n const payload = this.parseJwt(response.access_token);\n const result = {\n accessToken: {\n token: response.access_token\n },\n idToken: null, // Traditional OAuth doesn't provide id_token by default\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n auth2.requestAccessToken();\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAClE,CAAC;;ICFM,MAAM,cAAc,SAASC,cAAS,CAAC;IAC9C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5B,QAAQ,IAAI,CAAC,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C5D,6BAA6B;IAC7B,4BAA4B,OAAO,EAAE,IAAI;IACzC,4BAA4B,OAAO,EAAE;IACrC,gCAAgC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI;IAC5D,gCAAgC,UAAU,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;IACvE,gCAAgC,SAAS,EAAE,OAAO,CAAC,UAAU,IAAI,IAAI;IACrE,gCAAgC,EAAE,EAAE,OAAO,CAAC,GAAG,IAAI,IAAI;IACvD,gCAAgC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;IAC1D,gCAAgC,QAAQ,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI;IACjE,6BAA6B;IAC7B,yBAAyB,CAAC;IAC1B,wBAAwB,OAAO,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAChE,qBAAqB;IACrB,iBAAiB;IACjB,aAAa,CAAC,CAAC;IACf,YAAY,KAAK,CAAC,kBAAkB,EAAE,CAAC;IACvC,SAAS,CAAC,CAAC;IACX,KAAK;IACL;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst SocialLogin = registerPlugin(\"SocialLogin\", {\n web: () => import(\"./web\").then((m) => new m.SocialLoginWeb()),\n});\nexport * from \"./definitions\";\nexport { SocialLogin };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.googleClientId = null;\n this.appleClientId = null;\n this.googleScriptLoaded = false;\n this.appleScriptLoaded = false;\n this.appleScriptUrl = \"https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js\";\n this.facebookAppId = null;\n this.facebookScriptLoaded = false;\n }\n async initialize(options) {\n var _a, _b, _c;\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n this.googleClientId = options.google.webClientId;\n await this.loadGoogleScript();\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n this.appleClientId = options.apple.clientId;\n await this.loadAppleScript();\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n this.facebookAppId = options.facebook.appId;\n await this.loadFacebookScript();\n FB.init({\n appId: this.facebookAppId,\n version: \"v17.0\",\n xfbml: true,\n cookie: true,\n });\n }\n // Implement initialization for other providers if needed\n }\n async login(options) {\n if (options.provider === \"google\") {\n return this.loginWithGoogle(options.options);\n }\n else if (options.provider === \"apple\") {\n return this.loginWithApple(options.options);\n }\n else if (options.provider === \"facebook\") {\n return this.loginWithFacebook(options.options);\n }\n // Implement login for other providers\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n async logout(options) {\n switch (options.provider) {\n case \"google\":\n // Google doesn't have a specific logout method for web\n // We can revoke the token if we have it stored\n console.log(\"Google logout: Token should be revoked on the client side if stored\");\n break;\n case \"apple\":\n // Apple doesn't provide a logout method for web\n console.log(\"Apple logout: Session should be managed on the client side\");\n break;\n case \"facebook\":\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n default:\n throw new Error(`Logout for ${options.provider} is not implemented`);\n }\n }\n async isLoggedIn(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can check if there's a valid token\n const googleUser = await this.getGoogleUser();\n return { isLoggedIn: !!googleUser };\n case \"apple\":\n // Apple doesn't provide a method to check login status on web\n console.log(\"Apple login status should be managed on the client side\");\n return { isLoggedIn: false };\n case \"facebook\":\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === \"connected\" });\n });\n });\n default:\n throw new Error(`isLoggedIn for ${options.provider} is not implemented`);\n }\n }\n async getAuthorizationCode(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can use the id_token as the authorization code\n const googleUser = await this.getGoogleUser();\n if (googleUser && googleUser.credential) {\n return { jwt: googleUser.credential };\n }\n throw new Error(\"No Google authorization code available\");\n case \"apple\":\n // Apple authorization code should be obtained during login\n console.log(\"Apple authorization code should be stored during login\");\n throw new Error(\"Apple authorization code not available\");\n case \"facebook\":\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === \"connected\") {\n resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || \"\" });\n }\n else {\n reject(new Error(\"No Facebook authorization code available\"));\n }\n });\n });\n default:\n throw new Error(`getAuthorizationCode for ${options.provider} is not implemented`);\n }\n }\n async refresh(options) {\n switch (options.provider) {\n case \"google\":\n // For Google, we can prompt for re-authentication\n await this.loginWithGoogle(options.options);\n break;\n case \"apple\":\n // Apple doesn't provide a refresh method for web\n console.log(\"Apple refresh not available on web\");\n break;\n case \"facebook\":\n await this.loginWithFacebook(options.options);\n break;\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async loginWithGoogle(options) {\n if (!this.googleClientId) {\n throw new Error(\"Google Client ID not set. Call initialize() first.\");\n }\n const scopes = options.scopes || [\"email\", \"profile\"];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n return this.fallbackToTraditionalOAuth(scopes);\n }\n return new Promise((resolve, reject) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n console.log(\"google.accounts.id.initialize callback\", response);\n if (response.error) {\n reject(response.error);\n }\n else {\n const payload = this.parseJwt(response.credential);\n const result = {\n accessToken: null,\n idToken: response.credential,\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n auto_select: true\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n console.log(\"OneTap is not displayed or skipped\");\n // Fallback to traditional OAuth if One Tap is not available\n this.fallbackToTraditionalOAuth(scopes).then(resolve).catch(reject);\n }\n else {\n console.log(\"OneTap is displayed\");\n }\n });\n });\n }\n parseJwt(token) {\n const base64Url = token.split(\".\")[1];\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const jsonPayload = decodeURIComponent(atob(base64)\n .split(\"\")\n .map((c) => {\n return \"%\" + (\"00\" + c.charCodeAt(0).toString(16)).slice(-2);\n })\n .join(\"\"));\n return JSON.parse(jsonPayload);\n }\n async loadGoogleScript() {\n if (this.googleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://accounts.google.com/gsi/client\";\n script.async = true;\n script.onload = () => {\n this.googleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithApple(options) {\n if (!this.appleClientId) {\n throw new Error(\"Apple Client ID not set. Call initialize() first.\");\n }\n if (!this.appleScriptLoaded) {\n throw new Error(\"Apple Sign-In script not loaded.\");\n }\n return new Promise((resolve, reject) => {\n var _a;\n AppleID.auth.init({\n clientId: this.appleClientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(\" \")) || \"name email\",\n redirectURI: options.redirectUrl || window.location.href,\n state: options.state,\n nonce: options.nonce,\n usePopup: true,\n });\n AppleID.auth\n .signIn()\n .then((res) => {\n var _a, _b, _c, _d, _e, _f, _g;\n const result = {\n profile: {\n user: ((_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.firstName)\n ? `${res.user.name.firstName} ${res.user.name.lastName}`\n : \"\",\n email: ((_c = res.user) === null || _c === void 0 ? void 0 : _c.email) || null,\n givenName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.firstName) || null,\n familyName: ((_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.lastName) || null,\n },\n accessToken: {\n token: res.authorization.code, // TODO: to fix and find the correct token\n },\n idToken: res.authorization.id_token || null,\n };\n resolve({ provider: \"apple\", result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async loadAppleScript() {\n if (this.appleScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = this.appleScriptUrl;\n script.async = true;\n script.onload = () => {\n this.appleScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async getGoogleUser() {\n return new Promise((resolve) => {\n google.accounts.id.initialize({\n client_id: this.googleClientId,\n callback: (response) => {\n resolve(response);\n },\n });\n google.accounts.id.prompt((notification) => {\n if (notification.isNotDisplayed() || notification.isSkippedMoment()) {\n resolve(null);\n }\n });\n });\n }\n async loadFacebookScript() {\n if (this.facebookScriptLoaded)\n return;\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = \"https://connect.facebook.net/en_US/sdk.js\";\n script.async = true;\n script.defer = true;\n script.onload = () => {\n this.facebookScriptLoaded = true;\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n async loginWithFacebook(options) {\n if (!this.facebookAppId) {\n throw new Error(\"Facebook App ID not set. Call initialize() first.\");\n }\n return new Promise((resolve, reject) => {\n FB.login((response) => {\n if (response.status === \"connected\") {\n FB.api(\"/me\", { fields: \"id,name,email,picture\" }, (userInfo) => {\n var _a, _b;\n const result = {\n accessToken: {\n token: response.authResponse.accessToken,\n userId: response.authResponse.userID,\n },\n profile: {\n userID: userInfo.id,\n name: userInfo.name,\n email: userInfo.email || null,\n imageURL: ((_b = (_a = userInfo.picture) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || null,\n friendIDs: [],\n birthday: null,\n ageRange: null,\n gender: null,\n location: null,\n hometown: null,\n profileURL: null,\n },\n idToken: null,\n };\n resolve({ provider: \"facebook\", result });\n });\n }\n else {\n reject(new Error(\"Facebook login failed\"));\n }\n }, { scope: options.permissions.join(\",\") });\n });\n }\n async fallbackToTraditionalOAuth(scopes) {\n return new Promise((resolve, reject) => {\n const auth2 = google.accounts.oauth2.initTokenClient({\n client_id: this.googleClientId,\n scope: scopes.join(' '),\n callback: (response) => {\n if (response.error) {\n reject(response.error);\n }\n else {\n // Process the response similar to One Tap\n const payload = this.parseJwt(response.access_token);\n const result = {\n accessToken: {\n token: response.access_token\n },\n idToken: null, // Traditional OAuth doesn't provide id_token by default\n profile: {\n email: payload.email || null,\n familyName: payload.family_name || null,\n givenName: payload.given_name || null,\n id: payload.sub || null,\n name: payload.name || null,\n imageUrl: payload.picture || null,\n },\n };\n resolve({ provider: \"google\", result });\n }\n },\n });\n auth2.requestAccessToken();\n });\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,WAAW,GAAGA,mBAAc,CAAC,aAAa,EAAE;IAClD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IAClE,CAAC;;ICFM,MAAM,cAAc,SAASC,cAAS,CAAC;IAC9C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5B,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IACnC,QAAQ,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAClC,QAAQ,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IACxC,QAAQ,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACvC,QAAQ,IAAI,CAAC,cAAc,GAAG,sFAAsF,CAAC;IACrH,QAAQ,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAClC,QAAQ,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;IAC1C,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B,QAAQ,IAAI,EAAE,EAAE,EAAE,E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,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAChE,qBAAqB;IACrB,iBAAiB;IACjB,aAAa,CAAC,CAAC;IACf,YAAY,KAAK,CAAC,kBAAkB,EAAE,CAAC;IACvC,SAAS,CAAC,CAAC;IACX,KAAK;IACL;;;;;;;;;;;;;;;"}
@@ -1,6 +1,7 @@
1
1
  import Foundation
2
2
  import AuthenticationServices
3
3
  import Alamofire
4
+ import UIKit
4
5
 
5
6
  struct AppleProviderResponse: Codable {
6
7
  let accessToken: AccessTokenApple?
@@ -18,7 +19,14 @@ struct AppleProfile: Codable {
18
19
 
19
20
  struct AccessTokenApple: Codable {
20
21
  let token: String
21
- // Add other fields if needed
22
+ let expiresIn: Int?
23
+ let refreshToken: String?
24
+
25
+ init(token: String, expiresIn: Int? = nil, refreshToken: String? = nil) {
26
+ self.token = token
27
+ self.expiresIn = expiresIn
28
+ self.refreshToken = refreshToken
29
+ }
22
30
  }
23
31
 
24
32
  // Define the Decodable structs for the response
@@ -226,9 +234,16 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
226
234
  let fullName = appleIDCredential.fullName
227
235
  let email = appleIDCredential.email
228
236
 
237
+ // Create proper access token
238
+ let accessToken = AccessTokenApple(
239
+ token: String(data: appleIDCredential.authorizationCode ?? Data(), encoding: .utf8) ?? "",
240
+ expiresIn: 3600, // Default 1 hour
241
+ refreshToken: nil // Apple doesn't provide refresh token directly
242
+ )
243
+
229
244
  retrieveUserInfo { savedUserInfo in
230
245
  let response = AppleProviderResponse(
231
- accessToken: AccessTokenApple(token: ""), // You might need to implement this
246
+ accessToken: accessToken,
232
247
  profile: AppleProfile(
233
248
  user: userIdentifier,
234
249
  email: email ?? savedUserInfo?.profile.email,
@@ -356,15 +371,19 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
356
371
  do {
357
372
  try self.persistState(idToken: idToken, refreshToken: refreshToken, accessToken: accessToken)
358
373
  let appleResponse = AppleProviderResponse(
359
- accessToken: AccessTokenApple(token: ""), // You might need to implement this
374
+ accessToken: AccessTokenApple(
375
+ token: accessToken,
376
+ expiresIn: 3600, // Default 1 hour
377
+ refreshToken: refreshToken
378
+ ),
360
379
  profile: AppleProfile(
361
- user: "", // We don't have this information at this point
362
- email: nil, // We don't have this information at this point
363
- givenName: nil, // We don't have this information at this point
364
- familyName: nil // We don't have this information at this point
380
+ user: "",
381
+ email: nil,
382
+ givenName: nil,
383
+ familyName: nil
365
384
  ),
366
385
  idToken: idToken,
367
- authorizationCode: "" // We don't have this information at this point
386
+ authorizationCode: ""
368
387
  )
369
388
  completion(.success(appleResponse))
370
389
  return
@@ -376,9 +395,13 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
376
395
 
377
396
  if (pathComponents.filter { $0.name == "ios_no_code" }).first != nil {
378
397
  let appleResponse = AppleProviderResponse(
379
- accessToken: AccessTokenApple(token: ""), // You might need to implement this
398
+ accessToken: AccessTokenApple(
399
+ token: "",
400
+ expiresIn: 3600, // Default 1 hour
401
+ refreshToken: nil
402
+ ),
380
403
  profile: AppleProfile(
381
- user: "", // You might want to extract this from the identityToken
404
+ user: "",
382
405
  email: email,
383
406
  givenName: firstName,
384
407
  familyName: lastName
@@ -480,7 +503,7 @@ class AppleProvider: NSObject, ASAuthorizationControllerDelegate, ASAuthorizatio
480
503
  let userId = userData["sub"] as? String {
481
504
  // Create the response object
482
505
  let appleResponse = AppleProviderResponse(
483
- accessToken: AccessTokenApple(token: accessToken),
506
+ accessToken: AccessTokenApple(token: accessToken, expiresIn: expiresIn, refreshToken: refreshToken),
484
507
  profile: AppleProfile(
485
508
  user: userId,
486
509
  email: nil, // You might want to extract this from the idToken if available
@@ -9,7 +9,7 @@ import FacebookLogin
9
9
  struct FacebookLoginResponse {
10
10
  let accessToken: [String: Any]
11
11
  let profile: [String: Any]
12
- let authenticationToken: String?
12
+ let idToken: String?
13
13
  }
14
14
 
15
15
  class FacebookProvider {
@@ -88,7 +88,7 @@ class FacebookProvider {
88
88
  "isExpired": AccessToken.current?.isExpired ?? false,
89
89
  "refreshDate": AccessToken.current?.refreshDate ?? Date(),
90
90
  "permissions": AccessToken.current?.permissions.map { $0.name } ?? [],
91
- "accessToken": AccessToken.current?.tokenString ?? "",
91
+ "token": AccessToken.current?.tokenString ?? "",
92
92
  "userID": AccessToken.current?.userID ?? ""
93
93
  ]
94
94
 
@@ -109,7 +109,7 @@ class FacebookProvider {
109
109
  return FacebookLoginResponse(
110
110
  accessToken: accessToken,
111
111
  profile: profileData,
112
- authenticationToken: authToken?.tokenString
112
+ idToken: authToken?.tokenString
113
113
  )
114
114
  }
115
115
 
@@ -304,7 +304,7 @@ public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
304
304
  let facebookResult: [String: Any] = [
305
305
  "accessToken": facebookResponse.accessToken,
306
306
  "profile": facebookResponse.profile,
307
- "authenticationToken": facebookResponse.authenticationToken ?? ""
307
+ "idToken": facebookResponse.idToken ?? ""
308
308
  ]
309
309
  call.resolve([
310
310
  "provider": "facebook",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-social-login",
3
- "version": "0.0.64",
3
+ "version": "0.0.65",
4
4
  "description": "All social logins in one plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",