@capgo/capacitor-social-login 7.14.11 → 7.15.2

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.
@@ -146,7 +146,7 @@ public class FacebookProvider implements SocialProvider {
146
146
  public void getAuthorizationCode(PluginCall call) {
147
147
  AccessToken accessToken = AccessToken.getCurrentAccessToken();
148
148
  if (accessToken != null && !accessToken.isExpired()) {
149
- call.resolve(new JSObject().put("code", accessToken.getToken()));
149
+ call.resolve(new JSObject().put("accessToken", accessToken.getToken()));
150
150
  } else {
151
151
  call.reject("No valid access token found");
152
152
  }
@@ -18,7 +18,7 @@ import org.json.JSONObject;
18
18
  @CapacitorPlugin(name = "SocialLogin")
19
19
  public class SocialLoginPlugin extends Plugin {
20
20
 
21
- private final String pluginVersion = "7.14.11";
21
+ private final String pluginVersion = "7.15.2";
22
22
 
23
23
  public static String LOG_TAG = "CapgoSocialLogin";
24
24
 
@@ -24,10 +24,10 @@ export class AppleSocialLogin extends BaseSocialLogin {
24
24
  throw new Error('Apple Sign-In script not loaded.');
25
25
  }
26
26
  return new Promise((resolve, reject) => {
27
- var _a;
27
+ var _a, _b;
28
28
  AppleID.auth.init({
29
- clientId: this.clientId,
30
- scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',
29
+ clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : '',
30
+ scope: ((_b = options.scopes) === null || _b === void 0 ? void 0 : _b.join(' ')) || 'name email',
31
31
  redirectURI: this.redirectUrl || window.location.href,
32
32
  state: options.state,
33
33
  nonce: options.nonce,
@@ -1 +1 @@
1
- {"version":3,"file":"apple-provider.js","sourceRoot":"","sources":["../../src/apple-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAKzC,MAAM,OAAO,gBAAiB,SAAQ,eAAe;IAArD;;QACU,aAAQ,GAAkB,IAAI,CAAC;QAC/B,gBAAW,GAAkB,IA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AAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;QACvE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,oBAAoB;QACxB,2DAA2D;QAC3D,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,OAAO;QACX,iDAAiD;QACjD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IACpD,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO;QAE9B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAC/C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { BaseSocialLogin } from './base';\nimport type { AppleProviderOptions, AppleProviderResponse, AuthorizationCode, LoginResult } from './definitions';\n\ndeclare const AppleID: any;\n\nexport class AppleSocialLogin extends BaseSocialLogin {\n private clientId: string | null = null;\n private redirectUrl: string | null = null;\n private scriptLoaded = false;\n private scriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n private useProperTokenExchange = false;\n\n async initialize(\n clientId: string | null,\n redirectUrl: string | null | undefined,\n useProperTokenExchange = false,\n ): Promise<void> {\n this.clientId = clientId;\n this.redirectUrl = redirectUrl || null;\n this.useProperTokenExchange = useProperTokenExchange;\n\n if (clientId) {\n await this.loadAppleScript();\n }\n }\n\n async login(options: AppleProviderOptions): Promise<LoginResult> {\n if (!this.clientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n\n if (!this.scriptLoaded) {\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.clientId!,\n scope: options.scopes?.join(' ') || 'name email',\n redirectURI: this.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 let accessToken: { token: string } | null = null;\n\n if (this.useProperTokenExchange) {\n // When using proper token exchange, the authorization code should be exchanged\n // for a proper access token on the backend. For now, we set accessToken to null\n // and provide the authorization code in a separate field for backend processing.\n accessToken = null;\n } else {\n // Legacy behavior: use authorization code as access token for backward compatibility\n accessToken = {\n token: res.authorization.code || '',\n };\n }\n\n const result: AppleProviderResponse = {\n profile: {\n user: res.user || '',\n email: res.user?.email || null,\n givenName: res.user?.name?.firstName || null,\n familyName: res.user?.name?.lastName || null,\n },\n accessToken: accessToken,\n idToken: res.authorization.id_token || null,\n // Add authorization code for proper token exchange when flag is enabled\n ...(this.useProperTokenExchange && { authorizationCode: res.authorization.code }),\n };\n resolve({ provider: 'apple', result });\n })\n .catch((error: any) => {\n reject(error);\n });\n });\n }\n\n async logout(): Promise<void> {\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n }\n\n async isLoggedIn(): Promise<{ isLoggedIn: boolean }> {\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 }\n\n async getAuthorizationCode(): Promise<AuthorizationCode> {\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 }\n\n async refresh(): Promise<void> {\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n }\n\n private async loadAppleScript(): Promise<void> {\n if (this.scriptLoaded) return;\n\n return this.loadScript(this.scriptUrl).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"apple-provider.js","sourceRoot":"","sources":["../../src/apple-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAKzC,MAAM,OAAO,g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O,CAAC,GAAG,CAAC,4DAA4D,CAAC,CAAC;IAC5E,CAAC;IAED,KAAK,CAAC,UAAU;QACd,8DAA8D;QAC9D,OAAO,CAAC,GAAG,CAAC,yDAAyD,CAAC,CAAC;QACvE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,oBAAoB;QACxB,2DAA2D;QAC3D,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,OAAO;QACX,iDAAiD;QACjD,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IACpD,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO;QAE9B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAC/C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { BaseSocialLogin } from './base';\nimport type { AppleProviderOptions, AppleProviderResponse, AuthorizationCode, LoginResult } from './definitions';\n\ndeclare const AppleID: any;\n\nexport class AppleSocialLogin extends BaseSocialLogin {\n private clientId: string | null = null;\n private redirectUrl: string | null = null;\n private scriptLoaded = false;\n private scriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n private useProperTokenExchange = false;\n\n async initialize(\n clientId: string | null,\n redirectUrl: string | null | undefined,\n useProperTokenExchange = false,\n ): Promise<void> {\n this.clientId = clientId;\n this.redirectUrl = redirectUrl || null;\n this.useProperTokenExchange = useProperTokenExchange;\n\n if (clientId) {\n await this.loadAppleScript();\n }\n }\n\n async login(options: AppleProviderOptions): Promise<LoginResult> {\n if (!this.clientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n\n if (!this.scriptLoaded) {\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.clientId ?? '',\n scope: options.scopes?.join(' ') || 'name email',\n redirectURI: this.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 let accessToken: { token: string } | null = null;\n\n if (this.useProperTokenExchange) {\n // When using proper token exchange, the authorization code should be exchanged\n // for a proper access token on the backend. For now, we set accessToken to null\n // and provide the authorization code in a separate field for backend processing.\n accessToken = null;\n } else {\n // Legacy behavior: use authorization code as access token for backward compatibility\n accessToken = {\n token: res.authorization.code || '',\n };\n }\n\n const result: AppleProviderResponse = {\n profile: {\n user: res.user || '',\n email: res.user?.email || null,\n givenName: res.user?.name?.firstName || null,\n familyName: res.user?.name?.lastName || null,\n },\n accessToken: accessToken,\n idToken: res.authorization.id_token || null,\n // Add authorization code for proper token exchange when flag is enabled\n ...(this.useProperTokenExchange && { authorizationCode: res.authorization.code }),\n };\n resolve({ provider: 'apple', result });\n })\n .catch((error: any) => {\n reject(error);\n });\n });\n }\n\n async logout(): Promise<void> {\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n }\n\n async isLoggedIn(): Promise<{ isLoggedIn: boolean }> {\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 }\n\n async getAuthorizationCode(): Promise<AuthorizationCode> {\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 }\n\n async refresh(): Promise<void> {\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n }\n\n private async loadAppleScript(): Promise<void> {\n if (this.scriptLoaded) return;\n\n return this.loadScript(this.scriptUrl).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n"]}
@@ -77,7 +77,7 @@ export class FacebookSocialLogin extends BaseSocialLogin {
77
77
  FB.getLoginStatus((response) => {
78
78
  var _a;
79
79
  if (response.status === 'connected') {
80
- resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || '' });
80
+ resolve({ accessToken: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || '' });
81
81
  }
82
82
  else {
83
83
  reject(new Error('No Facebook authorization code available'));
@@ -1 +1 @@
1
- {"version":3,"file":"facebook-provider.js","sourceRoot":"","sources":["../../src/facebook-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAczC,MAAM,OAAO,mBAAoB,SAAQ,eAAe;IAAxD;;QACU,UAAK,GAAkB,IAAI,CAAC;QAC5B,iBAAY,GAAG,KAAK,CAAC;QACrB,WAAM,GAAG,OAAO,CAAC;IAwG3B,CAAC;IAtGC,KAAK,CAAC,UAAU,CAAC,KAAoB,EAAE,MAAe;QACpD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC;QAED,IAAI,KAAK,EAAE,CAAC;YACV,4CAA4C;YAC5C,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC3C,EAAE,CAAC,IAAI,CAAC;gBACN,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAA6B;QACvC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC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O,IAAI,CAAC,UAAU,CAAC,gCAAgC,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAChF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { BaseSocialLogin } from './base';\nimport type { FacebookLoginOptions, FacebookLoginResponse, AuthorizationCode, LoginResult } from './definitions';\n\ndeclare const FB: {\n init(options: any): void;\n login(\n callback: (response: { status: string; authResponse: { accessToken: string; userID: string } }) => void,\n options?: { scope: string },\n ): void;\n logout(callback: () => void): void;\n api(path: string, params: { fields: string }, callback: (response: any) => void): void;\n getLoginStatus(callback: (response: { status: string; authResponse?: { accessToken: string } }) => void): void;\n};\n\nexport class FacebookSocialLogin extends BaseSocialLogin {\n private appId: string | null = null;\n private scriptLoaded = false;\n private locale = 'en_US';\n\n async initialize(appId: string | null, locale?: string): Promise<void> {\n this.appId = appId;\n if (locale) {\n this.locale = locale;\n }\n\n if (appId) {\n // Load with the specified locale or default\n await this.loadFacebookScript(this.locale);\n FB.init({\n appId: this.appId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n }\n\n async login(options: FacebookLoginOptions): Promise<LoginResult> {\n if (!this.appId) {\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('/me', { fields: 'id,name,email,picture' }, (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 } else {\n reject(new Error('Facebook login failed'));\n }\n },\n { scope: options.permissions.join(',') },\n );\n });\n }\n\n async logout(): Promise<void> {\n return new Promise<void>((resolve) => {\n FB.logout(() => resolve());\n });\n }\n\n async isLoggedIn(): Promise<{ isLoggedIn: boolean }> {\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n }\n\n async getAuthorizationCode(): Promise<AuthorizationCode> {\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 }\n\n async refresh(options: FacebookLoginOptions): Promise<void> {\n await this.login(options);\n }\n\n private async loadFacebookScript(locale: string): Promise<void> {\n if (this.scriptLoaded) return;\n\n // Remove any existing Facebook SDK script\n const existingScript = document.querySelector('script[src*=\"connect.facebook.net\"]');\n if (existingScript) {\n existingScript.remove();\n }\n\n return this.loadScript(`https://connect.facebook.net/${locale}/sdk.js`).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n"]}
1
+ {"version":3,"file":"facebook-provider.js","sourceRoot":"","sources":["../../src/facebook-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAczC,MAAM,OAAO,mBAAoB,SAAQ,eAAe;IAAxD;;QACU,UAAK,GAAkB,IAAI,CAAC;QAC5B,iBAAY,GAAG,KAAK,CAAC;QACrB,WAAM,GAAG,OAAO,CAAC;IAwG3B,CAAC;IAtGC,KAAK,CAAC,UAAU,CAAC,KAAoB,EAAE,MAAe;QACpD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACvB,CAAC;QAED,IAAI,KAAK,EAAE,CAAC;YACV,4CAA4C;YAC5C,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC3C,EAAE,CAAC,IAAI,CA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L,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAA6B;QACzC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,MAAc;QAC7C,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO;QAE9B,0CAA0C;QAC1C,MAAM,cAAc,GAAG,QAAQ,CAAC,aAAa,CAAC,qCAAqC,CAAC,CAAC;QACrF,IAAI,cAAc,EAAE,CAAC;YACnB,cAAc,CAAC,MAAM,EAAE,CAAC;QAC1B,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,gCAAgC,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAChF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { BaseSocialLogin } from './base';\nimport type { FacebookLoginOptions, FacebookLoginResponse, AuthorizationCode, LoginResult } from './definitions';\n\ndeclare const FB: {\n init(options: any): void;\n login(\n callback: (response: { status: string; authResponse: { accessToken: string; userID: string } }) => void,\n options?: { scope: string },\n ): void;\n logout(callback: () => void): void;\n api(path: string, params: { fields: string }, callback: (response: any) => void): void;\n getLoginStatus(callback: (response: { status: string; authResponse?: { accessToken: string } }) => void): void;\n};\n\nexport class FacebookSocialLogin extends BaseSocialLogin {\n private appId: string | null = null;\n private scriptLoaded = false;\n private locale = 'en_US';\n\n async initialize(appId: string | null, locale?: string): Promise<void> {\n this.appId = appId;\n if (locale) {\n this.locale = locale;\n }\n\n if (appId) {\n // Load with the specified locale or default\n await this.loadFacebookScript(this.locale);\n FB.init({\n appId: this.appId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n }\n\n async login(options: FacebookLoginOptions): Promise<LoginResult> {\n if (!this.appId) {\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('/me', { fields: 'id,name,email,picture' }, (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 } else {\n reject(new Error('Facebook login failed'));\n }\n },\n { scope: options.permissions.join(',') },\n );\n });\n }\n\n async logout(): Promise<void> {\n return new Promise<void>((resolve) => {\n FB.logout(() => resolve());\n });\n }\n\n async isLoggedIn(): Promise<{ isLoggedIn: boolean }> {\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n }\n\n async getAuthorizationCode(): Promise<AuthorizationCode> {\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n if (response.status === 'connected') {\n resolve({ accessToken: response.authResponse?.accessToken || '' });\n } else {\n reject(new Error('No Facebook authorization code available'));\n }\n });\n });\n }\n\n async refresh(options: FacebookLoginOptions): Promise<void> {\n await this.login(options);\n }\n\n private async loadFacebookScript(locale: string): Promise<void> {\n if (this.scriptLoaded) return;\n\n // Remove any existing Facebook SDK script\n const existingScript = document.querySelector('script[src*=\"connect.facebook.net\"]');\n if (existingScript) {\n existingScript.remove();\n }\n\n return this.loadScript(`https://connect.facebook.net/${locale}/sdk.js`).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n"]}
@@ -272,8 +272,9 @@ export class GoogleSocialLogin extends BaseSocialLogin {
272
272
  }
273
273
  }
274
274
  async traditionalOAuth({ scopes, hostedDomain, nonce, prompt, }) {
275
+ var _a;
275
276
  const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];
276
- const params = new URLSearchParams(Object.assign(Object.assign({ client_id: this.clientId, redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));
277
+ const params = new URLSearchParams(Object.assign(Object.assign({ client_id: (_a = this.clientId) !== null && _a !== void 0 ? _a : '', redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));
277
278
  if (hostedDomain !== undefined) {
278
279
  params.append('hd', hostedDomain);
279
280
  }
@@ -1 +1 @@
1
- {"version":3,"file":"google-provider.js","sourceRoot":"","sources":["../../src/google-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGzC,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IAAtD;;QACU,aAAQ,GAAkB,IAAI,CAAC;QAE/B,cAAS,GAAyB,QAAQ,CAAC;QAE3C,6BAAwB,GAAG,gDAAgD,CAAC;QACnE,qBAAgB,GAAG,iCAAiC,CAAC;IAsZxE,CAAC;IApZC,KAAK,CAAC,UAAU,CACd,QAAuB,EACvB,IAA2B,EAC3B,YAA4B,EAC5B,WAAoB;QAEpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,CAAC;QACD,IAAI,CAAC,YAAY,GAAG,YAAkC,CAAC;QACvD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,KAAK,CACT,OAA2B;QAE3B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;QAED,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,EAAE,CAA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aAAa,CAAC,CAAC;gBACrD,KAAK,CAAC,KAAK,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;YACrC,CAAC,EAAE,MAAM,CAAC,CAAC;YAEX,mBAAmB,GAAG,WAAW,CAAC,GAAG,EAAE;gBACrC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;oBACjB,aAAa,CAAC,mBAAmB,CAAC,CAAC;oBACnC,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;gBACpC,CAAC;YACH,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { BaseSocialLogin } from './base';\nimport type { GoogleLoginOptions, LoginResult, ProviderResponseMap, AuthorizationCode } from './definitions';\n\nexport class GoogleSocialLogin extends BaseSocialLogin {\n private clientId: string | null = null;\n private hostedDomain?: string;\n private loginType: 'online' | 'offline' = 'online';\n private redirectUrl?: string;\n private GOOGLE_TOKEN_REQUEST_URL = 'https://www.googleapis.com/oauth2/v3/tokeninfo';\n private readonly GOOGLE_STATE_KEY = 'capgo_social_login_google_state';\n\n async initialize(\n clientId: string | null,\n mode?: 'online' | 'offline',\n hostedDomain?: string | null,\n redirectUrl?: string,\n ): Promise<void> {\n this.clientId = clientId;\n if (mode) {\n this.loginType = mode;\n }\n this.hostedDomain = hostedDomain as string | undefined;\n this.redirectUrl = redirectUrl;\n }\n\n async login<T extends 'google'>(\n options: GoogleLoginOptions,\n ): Promise<{ provider: T; result: ProviderResponseMap[T] }> {\n if (!this.clientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n\n let scopes = options.scopes || [];\n\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.email')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.email');\n }\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.profile')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.profile');\n }\n if (!scopes.includes('openid')) {\n scopes.push('openid');\n }\n } else {\n scopes = [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ];\n }\n\n const nonce = options.nonce || Math.random().toString(36).substring(2);\n\n // If scopes are provided, directly use the traditional OAuth flow\n return this.traditionalOAuth({\n scopes,\n nonce,\n hostedDomain: this.hostedDomain,\n prompt: options.prompt,\n });\n }\n\n async logout(): Promise<void> {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. logout is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state) return;\n await this.rawLogoutGoogle(state.accessToken);\n }\n\n async isLoggedIn(): Promise<{ isLoggedIn: boolean }> {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. isLoggedIn is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state) return { isLoggedIn: false };\n\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { isLoggedIn: true };\n } else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n } catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n return { isLoggedIn: false };\n }\n } catch (e) {\n return Promise.reject(e);\n }\n }\n\n async getAuthorizationCode(): Promise<AuthorizationCode> {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. getAuthorizationCode is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state) throw new Error('No Google authorization code available');\n\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { accessToken: state.accessToken, jwt: state.idToken };\n } else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n } catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n throw new Error('No Google authorization code available');\n }\n } catch (e) {\n return Promise.reject(e);\n }\n }\n\n async refresh(): Promise<void> {\n // For Google, we can prompt for re-authentication\n return Promise.reject('Not implemented');\n }\n\n handleOAuthRedirect(url: URL): LoginResult | null {\n const paramsRaw = url.searchParams;\n const code = paramsRaw.get('code');\n\n if (code && paramsRaw.has('scope')) {\n return {\n provider: 'google',\n result: {\n serverAuthCode: code,\n responseType: 'offline',\n },\n };\n }\n\n const hash = url.hash.substring(1);\n console.log('handleOAuthRedirect', url.hash);\n if (!hash) return null;\n console.log('handleOAuthRedirect ok');\n\n const params = new URLSearchParams(hash);\n const accessToken = params.get('access_token');\n const idToken = params.get('id_token');\n\n if (accessToken && idToken) {\n localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);\n const profile = this.parseJwt(idToken);\n return {\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n };\n }\n return null;\n }\n\n private async accessTokenIsValid(accessToken: string): Promise<boolean> {\n const url = `${this.GOOGLE_TOKEN_REQUEST_URL}?access_token=${encodeURIComponent(accessToken)}`;\n\n try {\n // Make the GET request using fetch\n const response = await fetch(url);\n\n // Check if the response is successful\n if (!response.ok) {\n console.log(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response not successful. Status code: ${response.status}. Assuming that the token is not valid`,\n );\n return false;\n }\n\n // Get the response body as text\n const responseBody = await response.text();\n\n if (!responseBody) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n }\n\n // Parse the response body as JSON\n let jsonObject: any;\n try {\n jsonObject = JSON.parse(responseBody);\n } catch (e) {\n console.error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`,\n );\n throw new Error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`,\n );\n }\n\n // Extract the 'expires_in' field\n const expiresInStr = jsonObject['expires_in'];\n\n if (expiresInStr === undefined || expiresInStr === null) {\n console.error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`,\n );\n throw new Error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`,\n );\n }\n\n // Parse 'expires_in' as an integer\n let expiresInInt: number;\n try {\n expiresInInt = parseInt(expiresInStr, 10);\n if (isNaN(expiresInInt)) {\n throw new Error(`'expires_in' is not a valid integer`);\n }\n } catch (e) {\n console.error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`,\n );\n throw new Error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`,\n );\n }\n\n // Determine if the access token is valid based on 'expires_in'\n return expiresInInt > 5;\n } catch (error) {\n console.error(error);\n throw error;\n }\n }\n\n private idTokenValid(idToken: string): boolean {\n try {\n const parsed = this.parseJwt(idToken);\n const currentTime = Math.ceil(Date.now() / 1000) + 5; // Convert current time to seconds since epoch\n return parsed.exp && currentTime < parsed.exp;\n } catch (e) {\n return false;\n }\n }\n\n private async rawLogoutGoogle(accessToken: string, tokenValid: boolean | null = null) {\n if (tokenValid === null) {\n tokenValid = await this.accessTokenIsValid(accessToken);\n }\n\n if (tokenValid === true) {\n try {\n await fetch(`https://accounts.google.com/o/oauth2/revoke?token=${encodeURIComponent(accessToken)}`);\n this.clearStateGoogle();\n } catch (e) {\n // ignore\n }\n return;\n } else {\n this.clearStateGoogle();\n return;\n }\n }\n\n private persistStateGoogle(accessToken: string, idToken: string) {\n try {\n window.localStorage.setItem(this.GOOGLE_STATE_KEY, JSON.stringify({ accessToken, idToken }));\n } catch (e) {\n console.error('Cannot persist state google', e);\n }\n }\n\n private clearStateGoogle() {\n try {\n window.localStorage.removeItem(this.GOOGLE_STATE_KEY);\n } catch (e) {\n console.error('Cannot clear state google', e);\n }\n }\n\n private getGoogleState(): { accessToken: string; idToken: string } | null {\n try {\n const state = window.localStorage.getItem(this.GOOGLE_STATE_KEY);\n if (!state) return null;\n const { accessToken, idToken } = JSON.parse(state);\n return { accessToken, idToken };\n } catch (e) {\n console.error('Cannot get state google', e);\n return null;\n }\n }\n\n private async traditionalOAuth<T extends 'google'>({\n scopes,\n hostedDomain,\n nonce,\n prompt,\n }: GoogleLoginOptions & { hostedDomain?: string }): Promise<{ provider: T; result: ProviderResponseMap[T] }> {\n const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];\n\n const params = new URLSearchParams({\n client_id: this.clientId!,\n redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname,\n response_type: this.loginType === 'offline' ? 'code' : 'token id_token',\n scope: uniqueScopes.join(' '),\n ...(nonce && { nonce }),\n include_granted_scopes: 'true',\n state: 'popup',\n });\n if (hostedDomain !== undefined) {\n params.append('hd', hostedDomain);\n }\n if (prompt !== undefined) {\n params.append('prompt', prompt);\n }\n\n const url = `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;\n const width = 500;\n const height = 600;\n const left = window.screenX + (window.outerWidth - width) / 2;\n const top = window.screenY + (window.outerHeight - height) / 2;\n localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, 'true');\n const popup = window.open(url, 'Google Sign In', `width=${width},height=${height},left=${left},top=${top},popup=1`);\n\n let popupClosedInterval: number;\n let timeoutHandle: number;\n\n // This may never return...\n return new Promise((resolve, reject) => {\n if (!popup) {\n reject(new Error('Failed to open popup'));\n return;\n }\n\n const handleMessage = (event: MessageEvent) => {\n if (event.origin !== window.location.origin || event.data?.source?.startsWith('angular')) return;\n\n if (event.data?.type === 'oauth-response') {\n window.removeEventListener('message', handleMessage);\n clearInterval(popupClosedInterval);\n\n if (this.loginType === 'online') {\n const { accessToken, idToken } = event.data;\n if (accessToken && idToken) {\n const profile = this.parseJwt(idToken);\n this.persistStateGoogle(accessToken.token, idToken);\n resolve({\n provider: 'google' as T,\n result: {\n accessToken: {\n token: accessToken.token,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n });\n }\n } else {\n const { serverAuthCode } = event.data as {\n serverAuthCode: string;\n };\n resolve({\n provider: 'google' as T,\n result: {\n responseType: 'offline',\n serverAuthCode,\n },\n });\n }\n }\n // Don't reject for non-OAuth messages, just ignore them\n };\n\n window.addEventListener('message', handleMessage);\n\n // Timeout after 5 minutes\n timeoutHandle = setTimeout(() => {\n clearTimeout(timeoutHandle);\n window.removeEventListener('message', handleMessage);\n popup.close();\n reject(new Error('OAuth timeout'));\n }, 300000);\n\n popupClosedInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(popupClosedInterval);\n reject(new Error('Popup closed'));\n }\n }, 1000);\n });\n }\n}\n"]}
1
+ {"version":3,"file":"google-provider.js","sourceRoot":"","sources":["../../src/google-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGzC,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IAAtD;;QACU,aAAQ,GAAkB,IAAI,CAAC;QAE/B,cAAS,GAAyB,QAAQ,CAAC;QAE3C,6BAAwB,GAAG,gDAAgD,CAAC;QACnE,qBAAgB,GAAG,iCAAiC,CAAC;IAsZxE,CAAC;IApZC,KAAK,CAAC,UAAU,CACd,QAAuB,EACvB,IAA2B,EAC3B,YAA4B,EAC5B,WAAoB;QAEpB,IAAI,CAAC,QAAQ,GAAG,QAAQ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,KAAK,CAAC,IAEhC,CAAC;wBACF,OAAO,CAAC;4BACN,QAAQ,EAAE,QAAa;4BACvB,MAAM,EAAE;gCACN,YAAY,EAAE,SAAS;gCACvB,cAAc;6BACf;yBACF,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBACD,wDAAwD;YAC1D,CAAC,CAAC;YAEF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;YAElD,0BAA0B;YAC1B,aAAa,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC9B,YAAY,CAAC,aAAa,CAAC,CAAC;gBAC5B,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;gBACrD,KAAK,CAAC,KAAK,EAAE,CAAC;gBACd,MAAM,CAAC,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;YACrC,CAAC,EAAE,MAAM,CAAC,CAAC;YAEX,mBAAmB,GAAG,WAAW,CAAC,GAAG,EAAE;gBACrC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;oBACjB,aAAa,CAAC,mBAAmB,CAAC,CAAC;oBACnC,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;gBACpC,CAAC;YACH,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["import { BaseSocialLogin } from './base';\nimport type { GoogleLoginOptions, LoginResult, ProviderResponseMap, AuthorizationCode } from './definitions';\n\nexport class GoogleSocialLogin extends BaseSocialLogin {\n private clientId: string | null = null;\n private hostedDomain?: string;\n private loginType: 'online' | 'offline' = 'online';\n private redirectUrl?: string;\n private GOOGLE_TOKEN_REQUEST_URL = 'https://www.googleapis.com/oauth2/v3/tokeninfo';\n private readonly GOOGLE_STATE_KEY = 'capgo_social_login_google_state';\n\n async initialize(\n clientId: string | null,\n mode?: 'online' | 'offline',\n hostedDomain?: string | null,\n redirectUrl?: string,\n ): Promise<void> {\n this.clientId = clientId;\n if (mode) {\n this.loginType = mode;\n }\n this.hostedDomain = hostedDomain as string | undefined;\n this.redirectUrl = redirectUrl;\n }\n\n async login<T extends 'google'>(\n options: GoogleLoginOptions,\n ): Promise<{ provider: T; result: ProviderResponseMap[T] }> {\n if (!this.clientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n\n let scopes = options.scopes || [];\n\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.email')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.email');\n }\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.profile')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.profile');\n }\n if (!scopes.includes('openid')) {\n scopes.push('openid');\n }\n } else {\n scopes = [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ];\n }\n\n const nonce = options.nonce || Math.random().toString(36).substring(2);\n\n // If scopes are provided, directly use the traditional OAuth flow\n return this.traditionalOAuth({\n scopes,\n nonce,\n hostedDomain: this.hostedDomain,\n prompt: options.prompt,\n });\n }\n\n async logout(): Promise<void> {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. logout is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state) return;\n await this.rawLogoutGoogle(state.accessToken);\n }\n\n async isLoggedIn(): Promise<{ isLoggedIn: boolean }> {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. isLoggedIn is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state) return { isLoggedIn: false };\n\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { isLoggedIn: true };\n } else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n } catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n return { isLoggedIn: false };\n }\n } catch (e) {\n return Promise.reject(e);\n }\n }\n\n async getAuthorizationCode(): Promise<AuthorizationCode> {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. getAuthorizationCode is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state) throw new Error('No Google authorization code available');\n\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { accessToken: state.accessToken, jwt: state.idToken };\n } else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n } catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n throw new Error('No Google authorization code available');\n }\n } catch (e) {\n return Promise.reject(e);\n }\n }\n\n async refresh(): Promise<void> {\n // For Google, we can prompt for re-authentication\n return Promise.reject('Not implemented');\n }\n\n handleOAuthRedirect(url: URL): LoginResult | null {\n const paramsRaw = url.searchParams;\n const code = paramsRaw.get('code');\n\n if (code && paramsRaw.has('scope')) {\n return {\n provider: 'google',\n result: {\n serverAuthCode: code,\n responseType: 'offline',\n },\n };\n }\n\n const hash = url.hash.substring(1);\n console.log('handleOAuthRedirect', url.hash);\n if (!hash) return null;\n console.log('handleOAuthRedirect ok');\n\n const params = new URLSearchParams(hash);\n const accessToken = params.get('access_token');\n const idToken = params.get('id_token');\n\n if (accessToken && idToken) {\n localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);\n const profile = this.parseJwt(idToken);\n return {\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n };\n }\n return null;\n }\n\n private async accessTokenIsValid(accessToken: string): Promise<boolean> {\n const url = `${this.GOOGLE_TOKEN_REQUEST_URL}?access_token=${encodeURIComponent(accessToken)}`;\n\n try {\n // Make the GET request using fetch\n const response = await fetch(url);\n\n // Check if the response is successful\n if (!response.ok) {\n console.log(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response not successful. Status code: ${response.status}. Assuming that the token is not valid`,\n );\n return false;\n }\n\n // Get the response body as text\n const responseBody = await response.text();\n\n if (!responseBody) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n }\n\n // Parse the response body as JSON\n let jsonObject: any;\n try {\n jsonObject = JSON.parse(responseBody);\n } catch (e) {\n console.error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`,\n );\n throw new Error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`,\n );\n }\n\n // Extract the 'expires_in' field\n const expiresInStr = jsonObject['expires_in'];\n\n if (expiresInStr === undefined || expiresInStr === null) {\n console.error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`,\n );\n throw new Error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`,\n );\n }\n\n // Parse 'expires_in' as an integer\n let expiresInInt: number;\n try {\n expiresInInt = parseInt(expiresInStr, 10);\n if (isNaN(expiresInInt)) {\n throw new Error(`'expires_in' is not a valid integer`);\n }\n } catch (e) {\n console.error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`,\n );\n throw new Error(\n `Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`,\n );\n }\n\n // Determine if the access token is valid based on 'expires_in'\n return expiresInInt > 5;\n } catch (error) {\n console.error(error);\n throw error;\n }\n }\n\n private idTokenValid(idToken: string): boolean {\n try {\n const parsed = this.parseJwt(idToken);\n const currentTime = Math.ceil(Date.now() / 1000) + 5; // Convert current time to seconds since epoch\n return parsed.exp && currentTime < parsed.exp;\n } catch (e) {\n return false;\n }\n }\n\n private async rawLogoutGoogle(accessToken: string, tokenValid: boolean | null = null) {\n if (tokenValid === null) {\n tokenValid = await this.accessTokenIsValid(accessToken);\n }\n\n if (tokenValid === true) {\n try {\n await fetch(`https://accounts.google.com/o/oauth2/revoke?token=${encodeURIComponent(accessToken)}`);\n this.clearStateGoogle();\n } catch (e) {\n // ignore\n }\n return;\n } else {\n this.clearStateGoogle();\n return;\n }\n }\n\n private persistStateGoogle(accessToken: string, idToken: string) {\n try {\n window.localStorage.setItem(this.GOOGLE_STATE_KEY, JSON.stringify({ accessToken, idToken }));\n } catch (e) {\n console.error('Cannot persist state google', e);\n }\n }\n\n private clearStateGoogle() {\n try {\n window.localStorage.removeItem(this.GOOGLE_STATE_KEY);\n } catch (e) {\n console.error('Cannot clear state google', e);\n }\n }\n\n private getGoogleState(): { accessToken: string; idToken: string } | null {\n try {\n const state = window.localStorage.getItem(this.GOOGLE_STATE_KEY);\n if (!state) return null;\n const { accessToken, idToken } = JSON.parse(state);\n return { accessToken, idToken };\n } catch (e) {\n console.error('Cannot get state google', e);\n return null;\n }\n }\n\n private async traditionalOAuth<T extends 'google'>({\n scopes,\n hostedDomain,\n nonce,\n prompt,\n }: GoogleLoginOptions & { hostedDomain?: string }): Promise<{ provider: T; result: ProviderResponseMap[T] }> {\n const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];\n\n const params = new URLSearchParams({\n client_id: this.clientId ?? '',\n redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname,\n response_type: this.loginType === 'offline' ? 'code' : 'token id_token',\n scope: uniqueScopes.join(' '),\n ...(nonce && { nonce }),\n include_granted_scopes: 'true',\n state: 'popup',\n });\n if (hostedDomain !== undefined) {\n params.append('hd', hostedDomain);\n }\n if (prompt !== undefined) {\n params.append('prompt', prompt);\n }\n\n const url = `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;\n const width = 500;\n const height = 600;\n const left = window.screenX + (window.outerWidth - width) / 2;\n const top = window.screenY + (window.outerHeight - height) / 2;\n localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, 'true');\n const popup = window.open(url, 'Google Sign In', `width=${width},height=${height},left=${left},top=${top},popup=1`);\n\n let popupClosedInterval: number;\n let timeoutHandle: number;\n\n // This may never return...\n return new Promise((resolve, reject) => {\n if (!popup) {\n reject(new Error('Failed to open popup'));\n return;\n }\n\n const handleMessage = (event: MessageEvent) => {\n if (event.origin !== window.location.origin || event.data?.source?.startsWith('angular')) return;\n\n if (event.data?.type === 'oauth-response') {\n window.removeEventListener('message', handleMessage);\n clearInterval(popupClosedInterval);\n\n if (this.loginType === 'online') {\n const { accessToken, idToken } = event.data;\n if (accessToken && idToken) {\n const profile = this.parseJwt(idToken);\n this.persistStateGoogle(accessToken.token, idToken);\n resolve({\n provider: 'google' as T,\n result: {\n accessToken: {\n token: accessToken.token,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n });\n }\n } else {\n const { serverAuthCode } = event.data as {\n serverAuthCode: string;\n };\n resolve({\n provider: 'google' as T,\n result: {\n responseType: 'offline',\n serverAuthCode,\n },\n });\n }\n }\n // Don't reject for non-OAuth messages, just ignore them\n };\n\n window.addEventListener('message', handleMessage);\n\n // Timeout after 5 minutes\n timeoutHandle = setTimeout(() => {\n clearTimeout(timeoutHandle);\n window.removeEventListener('message', handleMessage);\n popup.close();\n reject(new Error('OAuth timeout'));\n }, 300000);\n\n popupClosedInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(popupClosedInterval);\n reject(new Error('Popup closed'));\n }\n }, 1000);\n });\n }\n}\n"]}
@@ -61,10 +61,10 @@ class AppleSocialLogin extends BaseSocialLogin {
61
61
  throw new Error('Apple Sign-In script not loaded.');
62
62
  }
63
63
  return new Promise((resolve, reject) => {
64
- var _a;
64
+ var _a, _b;
65
65
  AppleID.auth.init({
66
- clientId: this.clientId,
67
- scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',
66
+ clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : '',
67
+ scope: ((_b = options.scopes) === null || _b === void 0 ? void 0 : _b.join(' ')) || 'name email',
68
68
  redirectURI: this.redirectUrl || window.location.href,
69
69
  state: options.state,
70
70
  nonce: options.nonce,
@@ -205,7 +205,7 @@ class FacebookSocialLogin extends BaseSocialLogin {
205
205
  FB.getLoginStatus((response) => {
206
206
  var _a;
207
207
  if (response.status === 'connected') {
208
- resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || '' });
208
+ resolve({ accessToken: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || '' });
209
209
  }
210
210
  else {
211
211
  reject(new Error('No Facebook authorization code available'));
@@ -503,8 +503,9 @@ class GoogleSocialLogin extends BaseSocialLogin {
503
503
  }
504
504
  }
505
505
  async traditionalOAuth({ scopes, hostedDomain, nonce, prompt, }) {
506
+ var _a;
506
507
  const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];
507
- const params = new URLSearchParams(Object.assign(Object.assign({ client_id: this.clientId, redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));
508
+ const params = new URLSearchParams(Object.assign(Object.assign({ client_id: (_a = this.clientId) !== null && _a !== void 0 ? _a : '', redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));
508
509
  if (hostedDomain !== undefined) {
509
510
  params.append('hd', hostedDomain);
510
511
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/base.js","esm/apple-provider.js","esm/facebook-provider.js","esm/google-provider.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 BaseSocialLogin extends WebPlugin {\n constructor() {\n super();\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 loadScript(src) {\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n script.onload = () => {\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n}\nBaseSocialLogin.OAUTH_STATE_KEY = 'social_login_oauth_pending';\n//# sourceMappingURL=base.js.map","import { BaseSocialLogin } from './base';\nexport class AppleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.redirectUrl = null;\n this.scriptLoaded = false;\n this.scriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n this.useProperTokenExchange = false;\n }\n async initialize(clientId, redirectUrl, useProperTokenExchange = false) {\n this.clientId = clientId;\n this.redirectUrl = redirectUrl || null;\n this.useProperTokenExchange = useProperTokenExchange;\n if (clientId) {\n await this.loadAppleScript();\n }\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n if (!this.scriptLoaded) {\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.clientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',\n redirectURI: this.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;\n let accessToken = null;\n if (this.useProperTokenExchange) {\n // When using proper token exchange, the authorization code should be exchanged\n // for a proper access token on the backend. For now, we set accessToken to null\n // and provide the authorization code in a separate field for backend processing.\n accessToken = null;\n }\n else {\n // Legacy behavior: use authorization code as access token for backward compatibility\n accessToken = {\n token: res.authorization.code || '',\n };\n }\n const result = Object.assign({ profile: {\n user: res.user || '',\n email: ((_a = res.user) === null || _a === void 0 ? void 0 : _a.email) || null,\n givenName: ((_c = (_b = res.user) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.firstName) || null,\n familyName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.lastName) || null,\n }, accessToken: accessToken, idToken: res.authorization.id_token || null }, (this.useProperTokenExchange && { authorizationCode: res.authorization.code }));\n resolve({ provider: 'apple', result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async logout() {\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n }\n async isLoggedIn() {\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 }\n async getAuthorizationCode() {\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 }\n async refresh() {\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n }\n async loadAppleScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript(this.scriptUrl).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=apple-provider.js.map","import { BaseSocialLogin } from './base';\nexport class FacebookSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.appId = null;\n this.scriptLoaded = false;\n this.locale = 'en_US';\n }\n async initialize(appId, locale) {\n this.appId = appId;\n if (locale) {\n this.locale = locale;\n }\n if (appId) {\n // Load with the specified locale or default\n await this.loadFacebookScript(this.locale);\n FB.init({\n appId: this.appId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n }\n async login(options) {\n if (!this.appId) {\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 logout() {\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n }\n async isLoggedIn() {\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n }\n async getAuthorizationCode() {\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 }\n async refresh(options) {\n await this.login(options);\n }\n async loadFacebookScript(locale) {\n if (this.scriptLoaded)\n return;\n // Remove any existing Facebook SDK script\n const existingScript = document.querySelector('script[src*=\"connect.facebook.net\"]');\n if (existingScript) {\n existingScript.remove();\n }\n return this.loadScript(`https://connect.facebook.net/${locale}/sdk.js`).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=facebook-provider.js.map","import { BaseSocialLogin } from './base';\nexport class GoogleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.loginType = 'online';\n this.GOOGLE_TOKEN_REQUEST_URL = 'https://www.googleapis.com/oauth2/v3/tokeninfo';\n this.GOOGLE_STATE_KEY = 'capgo_social_login_google_state';\n }\n async initialize(clientId, mode, hostedDomain, redirectUrl) {\n this.clientId = clientId;\n if (mode) {\n this.loginType = mode;\n }\n this.hostedDomain = hostedDomain;\n this.redirectUrl = redirectUrl;\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n let scopes = options.scopes || [];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.email')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.email');\n }\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.profile')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.profile');\n }\n if (!scopes.includes('openid')) {\n scopes.push('openid');\n }\n }\n else {\n scopes = [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ];\n }\n const nonce = options.nonce || Math.random().toString(36).substring(2);\n // If scopes are provided, directly use the traditional OAuth flow\n return this.traditionalOAuth({\n scopes,\n nonce,\n hostedDomain: this.hostedDomain,\n prompt: options.prompt,\n });\n }\n async logout() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. logout is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return;\n await this.rawLogoutGoogle(state.accessToken);\n }\n async isLoggedIn() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. isLoggedIn is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return { isLoggedIn: false };\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { isLoggedIn: true };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n return { isLoggedIn: false };\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async getAuthorizationCode() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. getAuthorizationCode is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n throw new Error('No Google authorization code available');\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { accessToken: state.accessToken, jwt: state.idToken };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n throw new Error('No Google authorization code available');\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async refresh() {\n // For Google, we can prompt for re-authentication\n return Promise.reject('Not implemented');\n }\n handleOAuthRedirect(url) {\n const paramsRaw = url.searchParams;\n const code = paramsRaw.get('code');\n if (code && paramsRaw.has('scope')) {\n return {\n provider: 'google',\n result: {\n serverAuthCode: code,\n responseType: 'offline',\n },\n };\n }\n const hash = url.hash.substring(1);\n console.log('handleOAuthRedirect', url.hash);\n if (!hash)\n return null;\n console.log('handleOAuthRedirect ok');\n const params = new URLSearchParams(hash);\n const accessToken = params.get('access_token');\n const idToken = params.get('id_token');\n if (accessToken && idToken) {\n localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);\n const profile = this.parseJwt(idToken);\n return {\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n };\n }\n return null;\n }\n async accessTokenIsValid(accessToken) {\n const url = `${this.GOOGLE_TOKEN_REQUEST_URL}?access_token=${encodeURIComponent(accessToken)}`;\n try {\n // Make the GET request using fetch\n const response = await fetch(url);\n // Check if the response is successful\n if (!response.ok) {\n console.log(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response not successful. Status code: ${response.status}. Assuming that the token is not valid`);\n return false;\n }\n // Get the response body as text\n const responseBody = await response.text();\n if (!responseBody) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n }\n // Parse the response body as JSON\n let jsonObject;\n try {\n jsonObject = JSON.parse(responseBody);\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n }\n // Extract the 'expires_in' field\n const expiresInStr = jsonObject['expires_in'];\n if (expiresInStr === undefined || expiresInStr === null) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n }\n // Parse 'expires_in' as an integer\n let expiresInInt;\n try {\n expiresInInt = parseInt(expiresInStr, 10);\n if (isNaN(expiresInInt)) {\n throw new Error(`'expires_in' is not a valid integer`);\n }\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n }\n // Determine if the access token is valid based on 'expires_in'\n return expiresInInt > 5;\n }\n catch (error) {\n console.error(error);\n throw error;\n }\n }\n idTokenValid(idToken) {\n try {\n const parsed = this.parseJwt(idToken);\n const currentTime = Math.ceil(Date.now() / 1000) + 5; // Convert current time to seconds since epoch\n return parsed.exp && currentTime < parsed.exp;\n }\n catch (e) {\n return false;\n }\n }\n async rawLogoutGoogle(accessToken, tokenValid = null) {\n if (tokenValid === null) {\n tokenValid = await this.accessTokenIsValid(accessToken);\n }\n if (tokenValid === true) {\n try {\n await fetch(`https://accounts.google.com/o/oauth2/revoke?token=${encodeURIComponent(accessToken)}`);\n this.clearStateGoogle();\n }\n catch (e) {\n // ignore\n }\n return;\n }\n else {\n this.clearStateGoogle();\n return;\n }\n }\n persistStateGoogle(accessToken, idToken) {\n try {\n window.localStorage.setItem(this.GOOGLE_STATE_KEY, JSON.stringify({ accessToken, idToken }));\n }\n catch (e) {\n console.error('Cannot persist state google', e);\n }\n }\n clearStateGoogle() {\n try {\n window.localStorage.removeItem(this.GOOGLE_STATE_KEY);\n }\n catch (e) {\n console.error('Cannot clear state google', e);\n }\n }\n getGoogleState() {\n try {\n const state = window.localStorage.getItem(this.GOOGLE_STATE_KEY);\n if (!state)\n return null;\n const { accessToken, idToken } = JSON.parse(state);\n return { accessToken, idToken };\n }\n catch (e) {\n console.error('Cannot get state google', e);\n return null;\n }\n }\n async traditionalOAuth({ scopes, hostedDomain, nonce, prompt, }) {\n const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];\n const params = new URLSearchParams(Object.assign(Object.assign({ client_id: this.clientId, redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));\n if (hostedDomain !== undefined) {\n params.append('hd', hostedDomain);\n }\n if (prompt !== undefined) {\n params.append('prompt', prompt);\n }\n const url = `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;\n const width = 500;\n const height = 600;\n const left = window.screenX + (window.outerWidth - width) / 2;\n const top = window.screenY + (window.outerHeight - height) / 2;\n localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, 'true');\n const popup = window.open(url, 'Google Sign In', `width=${width},height=${height},left=${left},top=${top},popup=1`);\n let popupClosedInterval;\n let timeoutHandle;\n // This may never return...\n return new Promise((resolve, reject) => {\n if (!popup) {\n reject(new Error('Failed to open popup'));\n return;\n }\n const handleMessage = (event) => {\n var _a, _b, _c;\n if (event.origin !== window.location.origin || ((_b = (_a = event.data) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.startsWith('angular')))\n return;\n if (((_c = event.data) === null || _c === void 0 ? void 0 : _c.type) === 'oauth-response') {\n window.removeEventListener('message', handleMessage);\n clearInterval(popupClosedInterval);\n if (this.loginType === 'online') {\n const { accessToken, idToken } = event.data;\n if (accessToken && idToken) {\n const profile = this.parseJwt(idToken);\n this.persistStateGoogle(accessToken.token, idToken);\n resolve({\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken.token,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n });\n }\n }\n else {\n const { serverAuthCode } = event.data;\n resolve({\n provider: 'google',\n result: {\n responseType: 'offline',\n serverAuthCode,\n },\n });\n }\n }\n // Don't reject for non-OAuth messages, just ignore them\n };\n window.addEventListener('message', handleMessage);\n // Timeout after 5 minutes\n timeoutHandle = setTimeout(() => {\n clearTimeout(timeoutHandle);\n window.removeEventListener('message', handleMessage);\n popup.close();\n reject(new Error('OAuth timeout'));\n }, 300000);\n popupClosedInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(popupClosedInterval);\n reject(new Error('Popup closed'));\n }\n }, 1000);\n });\n }\n}\n//# sourceMappingURL=google-provider.js.map","import { WebPlugin } from '@capacitor/core';\nimport { AppleSocialLogin } from './apple-provider';\nimport { FacebookSocialLogin } from './facebook-provider';\nimport { GoogleSocialLogin } from './google-provider';\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n var _a;\n super();\n this.googleProvider = new GoogleSocialLogin();\n this.appleProvider = new AppleSocialLogin();\n this.facebookProvider = new FacebookSocialLogin();\n // Set up listener for OAuth redirects if we have a pending OAuth flow\n if (localStorage.getItem(SocialLoginWeb.OAUTH_STATE_KEY)) {\n console.log('OAUTH_STATE_KEY found');\n const result = this.handleOAuthRedirect();\n if (result) {\n (_a = window.opener) === null || _a === void 0 ? void 0 : _a.postMessage(Object.assign({ type: 'oauth-response' }, result.result), window.location.origin);\n window.close();\n }\n }\n }\n handleOAuthRedirect() {\n const url = new URL(window.location.href);\n return this.googleProvider.handleOAuthRedirect(url);\n }\n async initialize(options) {\n var _a, _b, _c;\n const initPromises = [];\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n initPromises.push(this.googleProvider.initialize(options.google.webClientId, options.google.mode, options.google.hostedDomain, options.google.redirectUrl));\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n initPromises.push(this.appleProvider.initialize(options.apple.clientId, options.apple.redirectUrl, options.apple.useProperTokenExchange));\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n initPromises.push(this.facebookProvider.initialize(options.facebook.appId, options.facebook.locale));\n }\n await Promise.all(initPromises);\n }\n async login(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.login(options.options);\n case 'apple':\n return this.appleProvider.login(options.options);\n case 'facebook':\n return this.facebookProvider.login(options.options);\n default:\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n }\n async logout(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.logout();\n case 'apple':\n return this.appleProvider.logout();\n case 'facebook':\n return this.facebookProvider.logout();\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 return this.googleProvider.isLoggedIn();\n case 'apple':\n return this.appleProvider.isLoggedIn();\n case 'facebook':\n return this.facebookProvider.isLoggedIn();\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 return this.googleProvider.getAuthorizationCode();\n case 'apple':\n return this.appleProvider.getAuthorizationCode();\n case 'facebook':\n return this.facebookProvider.getAuthorizationCode();\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 return this.googleProvider.refresh();\n case 'apple':\n return this.appleProvider.refresh();\n case 'facebook':\n return this.facebookProvider.refresh(options.options);\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async providerSpecificCall(options) {\n throw new Error(`Provider specific call for ${options.call} is not implemented`);\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\nSocialLoginWeb.OAUTH_STATE_KEY = 'social_login_oauth_pending';\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,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,EAAE;AACf,IAAI;AACJ,IAAI,QAAQ,CAAC,KAAK,EAAE;AACpB,QAAQ,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,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,OAAO,CAAC,QAAQ;AAChC,YAAY,KAAK,QAAQ;AACzB,gBAAgB,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;AACpD,YAAY,KAAK,OAAO;AACxB,gBAAgB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;AACnD,YAAY,KAAK,UAAU;AAC3B,gBAAgB,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;AACrE,YAAY;AACZ,gBAAgB,MAAM,IAAI,KAAK,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AACrF;AACA,IAAI;AACJ,IAAI,MAAM,oBAAoB,CAAC,OAAO,EAAE;AACxC,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,2BAA2B,EAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;AACxF,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;AACA,cAAc,CAAC,eAAe,GAAG,4BAA4B;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/base.js","esm/apple-provider.js","esm/facebook-provider.js","esm/google-provider.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 BaseSocialLogin extends WebPlugin {\n constructor() {\n super();\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 loadScript(src) {\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n script.onload = () => {\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n}\nBaseSocialLogin.OAUTH_STATE_KEY = 'social_login_oauth_pending';\n//# sourceMappingURL=base.js.map","import { BaseSocialLogin } from './base';\nexport class AppleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.redirectUrl = null;\n this.scriptLoaded = false;\n this.scriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n this.useProperTokenExchange = false;\n }\n async initialize(clientId, redirectUrl, useProperTokenExchange = false) {\n this.clientId = clientId;\n this.redirectUrl = redirectUrl || null;\n this.useProperTokenExchange = useProperTokenExchange;\n if (clientId) {\n await this.loadAppleScript();\n }\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n if (!this.scriptLoaded) {\n throw new Error('Apple Sign-In script not loaded.');\n }\n return new Promise((resolve, reject) => {\n var _a, _b;\n AppleID.auth.init({\n clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : '',\n scope: ((_b = options.scopes) === null || _b === void 0 ? void 0 : _b.join(' ')) || 'name email',\n redirectURI: this.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;\n let accessToken = null;\n if (this.useProperTokenExchange) {\n // When using proper token exchange, the authorization code should be exchanged\n // for a proper access token on the backend. For now, we set accessToken to null\n // and provide the authorization code in a separate field for backend processing.\n accessToken = null;\n }\n else {\n // Legacy behavior: use authorization code as access token for backward compatibility\n accessToken = {\n token: res.authorization.code || '',\n };\n }\n const result = Object.assign({ profile: {\n user: res.user || '',\n email: ((_a = res.user) === null || _a === void 0 ? void 0 : _a.email) || null,\n givenName: ((_c = (_b = res.user) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.firstName) || null,\n familyName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.lastName) || null,\n }, accessToken: accessToken, idToken: res.authorization.id_token || null }, (this.useProperTokenExchange && { authorizationCode: res.authorization.code }));\n resolve({ provider: 'apple', result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async logout() {\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n }\n async isLoggedIn() {\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 }\n async getAuthorizationCode() {\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 }\n async refresh() {\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n }\n async loadAppleScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript(this.scriptUrl).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=apple-provider.js.map","import { BaseSocialLogin } from './base';\nexport class FacebookSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.appId = null;\n this.scriptLoaded = false;\n this.locale = 'en_US';\n }\n async initialize(appId, locale) {\n this.appId = appId;\n if (locale) {\n this.locale = locale;\n }\n if (appId) {\n // Load with the specified locale or default\n await this.loadFacebookScript(this.locale);\n FB.init({\n appId: this.appId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n }\n async login(options) {\n if (!this.appId) {\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 logout() {\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n }\n async isLoggedIn() {\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n }\n async getAuthorizationCode() {\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === 'connected') {\n resolve({ accessToken: ((_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 }\n async refresh(options) {\n await this.login(options);\n }\n async loadFacebookScript(locale) {\n if (this.scriptLoaded)\n return;\n // Remove any existing Facebook SDK script\n const existingScript = document.querySelector('script[src*=\"connect.facebook.net\"]');\n if (existingScript) {\n existingScript.remove();\n }\n return this.loadScript(`https://connect.facebook.net/${locale}/sdk.js`).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=facebook-provider.js.map","import { BaseSocialLogin } from './base';\nexport class GoogleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.loginType = 'online';\n this.GOOGLE_TOKEN_REQUEST_URL = 'https://www.googleapis.com/oauth2/v3/tokeninfo';\n this.GOOGLE_STATE_KEY = 'capgo_social_login_google_state';\n }\n async initialize(clientId, mode, hostedDomain, redirectUrl) {\n this.clientId = clientId;\n if (mode) {\n this.loginType = mode;\n }\n this.hostedDomain = hostedDomain;\n this.redirectUrl = redirectUrl;\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n let scopes = options.scopes || [];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.email')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.email');\n }\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.profile')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.profile');\n }\n if (!scopes.includes('openid')) {\n scopes.push('openid');\n }\n }\n else {\n scopes = [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ];\n }\n const nonce = options.nonce || Math.random().toString(36).substring(2);\n // If scopes are provided, directly use the traditional OAuth flow\n return this.traditionalOAuth({\n scopes,\n nonce,\n hostedDomain: this.hostedDomain,\n prompt: options.prompt,\n });\n }\n async logout() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. logout is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return;\n await this.rawLogoutGoogle(state.accessToken);\n }\n async isLoggedIn() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. isLoggedIn is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return { isLoggedIn: false };\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { isLoggedIn: true };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n return { isLoggedIn: false };\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async getAuthorizationCode() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. getAuthorizationCode is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n throw new Error('No Google authorization code available');\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { accessToken: state.accessToken, jwt: state.idToken };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n throw new Error('No Google authorization code available');\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async refresh() {\n // For Google, we can prompt for re-authentication\n return Promise.reject('Not implemented');\n }\n handleOAuthRedirect(url) {\n const paramsRaw = url.searchParams;\n const code = paramsRaw.get('code');\n if (code && paramsRaw.has('scope')) {\n return {\n provider: 'google',\n result: {\n serverAuthCode: code,\n responseType: 'offline',\n },\n };\n }\n const hash = url.hash.substring(1);\n console.log('handleOAuthRedirect', url.hash);\n if (!hash)\n return null;\n console.log('handleOAuthRedirect ok');\n const params = new URLSearchParams(hash);\n const accessToken = params.get('access_token');\n const idToken = params.get('id_token');\n if (accessToken && idToken) {\n localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);\n const profile = this.parseJwt(idToken);\n return {\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n };\n }\n return null;\n }\n async accessTokenIsValid(accessToken) {\n const url = `${this.GOOGLE_TOKEN_REQUEST_URL}?access_token=${encodeURIComponent(accessToken)}`;\n try {\n // Make the GET request using fetch\n const response = await fetch(url);\n // Check if the response is successful\n if (!response.ok) {\n console.log(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response not successful. Status code: ${response.status}. Assuming that the token is not valid`);\n return false;\n }\n // Get the response body as text\n const responseBody = await response.text();\n if (!responseBody) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n }\n // Parse the response body as JSON\n let jsonObject;\n try {\n jsonObject = JSON.parse(responseBody);\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n }\n // Extract the 'expires_in' field\n const expiresInStr = jsonObject['expires_in'];\n if (expiresInStr === undefined || expiresInStr === null) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n }\n // Parse 'expires_in' as an integer\n let expiresInInt;\n try {\n expiresInInt = parseInt(expiresInStr, 10);\n if (isNaN(expiresInInt)) {\n throw new Error(`'expires_in' is not a valid integer`);\n }\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n }\n // Determine if the access token is valid based on 'expires_in'\n return expiresInInt > 5;\n }\n catch (error) {\n console.error(error);\n throw error;\n }\n }\n idTokenValid(idToken) {\n try {\n const parsed = this.parseJwt(idToken);\n const currentTime = Math.ceil(Date.now() / 1000) + 5; // Convert current time to seconds since epoch\n return parsed.exp && currentTime < parsed.exp;\n }\n catch (e) {\n return false;\n }\n }\n async rawLogoutGoogle(accessToken, tokenValid = null) {\n if (tokenValid === null) {\n tokenValid = await this.accessTokenIsValid(accessToken);\n }\n if (tokenValid === true) {\n try {\n await fetch(`https://accounts.google.com/o/oauth2/revoke?token=${encodeURIComponent(accessToken)}`);\n this.clearStateGoogle();\n }\n catch (e) {\n // ignore\n }\n return;\n }\n else {\n this.clearStateGoogle();\n return;\n }\n }\n persistStateGoogle(accessToken, idToken) {\n try {\n window.localStorage.setItem(this.GOOGLE_STATE_KEY, JSON.stringify({ accessToken, idToken }));\n }\n catch (e) {\n console.error('Cannot persist state google', e);\n }\n }\n clearStateGoogle() {\n try {\n window.localStorage.removeItem(this.GOOGLE_STATE_KEY);\n }\n catch (e) {\n console.error('Cannot clear state google', e);\n }\n }\n getGoogleState() {\n try {\n const state = window.localStorage.getItem(this.GOOGLE_STATE_KEY);\n if (!state)\n return null;\n const { accessToken, idToken } = JSON.parse(state);\n return { accessToken, idToken };\n }\n catch (e) {\n console.error('Cannot get state google', e);\n return null;\n }\n }\n async traditionalOAuth({ scopes, hostedDomain, nonce, prompt, }) {\n var _a;\n const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];\n const params = new URLSearchParams(Object.assign(Object.assign({ client_id: (_a = this.clientId) !== null && _a !== void 0 ? _a : '', redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));\n if (hostedDomain !== undefined) {\n params.append('hd', hostedDomain);\n }\n if (prompt !== undefined) {\n params.append('prompt', prompt);\n }\n const url = `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;\n const width = 500;\n const height = 600;\n const left = window.screenX + (window.outerWidth - width) / 2;\n const top = window.screenY + (window.outerHeight - height) / 2;\n localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, 'true');\n const popup = window.open(url, 'Google Sign In', `width=${width},height=${height},left=${left},top=${top},popup=1`);\n let popupClosedInterval;\n let timeoutHandle;\n // This may never return...\n return new Promise((resolve, reject) => {\n if (!popup) {\n reject(new Error('Failed to open popup'));\n return;\n }\n const handleMessage = (event) => {\n var _a, _b, _c;\n if (event.origin !== window.location.origin || ((_b = (_a = event.data) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.startsWith('angular')))\n return;\n if (((_c = event.data) === null || _c === void 0 ? void 0 : _c.type) === 'oauth-response') {\n window.removeEventListener('message', handleMessage);\n clearInterval(popupClosedInterval);\n if (this.loginType === 'online') {\n const { accessToken, idToken } = event.data;\n if (accessToken && idToken) {\n const profile = this.parseJwt(idToken);\n this.persistStateGoogle(accessToken.token, idToken);\n resolve({\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken.token,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n });\n }\n }\n else {\n const { serverAuthCode } = event.data;\n resolve({\n provider: 'google',\n result: {\n responseType: 'offline',\n serverAuthCode,\n },\n });\n }\n }\n // Don't reject for non-OAuth messages, just ignore them\n };\n window.addEventListener('message', handleMessage);\n // Timeout after 5 minutes\n timeoutHandle = setTimeout(() => {\n clearTimeout(timeoutHandle);\n window.removeEventListener('message', handleMessage);\n popup.close();\n reject(new Error('OAuth timeout'));\n }, 300000);\n popupClosedInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(popupClosedInterval);\n reject(new Error('Popup closed'));\n }\n }, 1000);\n });\n }\n}\n//# sourceMappingURL=google-provider.js.map","import { WebPlugin } from '@capacitor/core';\nimport { AppleSocialLogin } from './apple-provider';\nimport { FacebookSocialLogin } from './facebook-provider';\nimport { GoogleSocialLogin } from './google-provider';\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n var _a;\n super();\n this.googleProvider = new GoogleSocialLogin();\n this.appleProvider = new AppleSocialLogin();\n this.facebookProvider = new FacebookSocialLogin();\n // Set up listener for OAuth redirects if we have a pending OAuth flow\n if (localStorage.getItem(SocialLoginWeb.OAUTH_STATE_KEY)) {\n console.log('OAUTH_STATE_KEY found');\n const result = this.handleOAuthRedirect();\n if (result) {\n (_a = window.opener) === null || _a === void 0 ? void 0 : _a.postMessage(Object.assign({ type: 'oauth-response' }, result.result), window.location.origin);\n window.close();\n }\n }\n }\n handleOAuthRedirect() {\n const url = new URL(window.location.href);\n return this.googleProvider.handleOAuthRedirect(url);\n }\n async initialize(options) {\n var _a, _b, _c;\n const initPromises = [];\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n initPromises.push(this.googleProvider.initialize(options.google.webClientId, options.google.mode, options.google.hostedDomain, options.google.redirectUrl));\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n initPromises.push(this.appleProvider.initialize(options.apple.clientId, options.apple.redirectUrl, options.apple.useProperTokenExchange));\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n initPromises.push(this.facebookProvider.initialize(options.facebook.appId, options.facebook.locale));\n }\n await Promise.all(initPromises);\n }\n async login(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.login(options.options);\n case 'apple':\n return this.appleProvider.login(options.options);\n case 'facebook':\n return this.facebookProvider.login(options.options);\n default:\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n }\n async logout(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.logout();\n case 'apple':\n return this.appleProvider.logout();\n case 'facebook':\n return this.facebookProvider.logout();\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 return this.googleProvider.isLoggedIn();\n case 'apple':\n return this.appleProvider.isLoggedIn();\n case 'facebook':\n return this.facebookProvider.isLoggedIn();\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 return this.googleProvider.getAuthorizationCode();\n case 'apple':\n return this.appleProvider.getAuthorizationCode();\n case 'facebook':\n return this.facebookProvider.getAuthorizationCode();\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 return this.googleProvider.refresh();\n case 'apple':\n return this.appleProvider.refresh();\n case 'facebook':\n return this.facebookProvider.refresh(options.options);\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async providerSpecificCall(options) {\n throw new Error(`Provider specific call for ${options.call} is not implemented`);\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\nSocialLoginWeb.OAUTH_STATE_KEY = 'social_login_oauth_pending';\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,eAAe,SAASC,cAAS,CAAC;AAC/C,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,EAAE;AACf,IAAI;AACJ,IAAI,QAAQ,CAAC,KAAK,EAAE;AACpB,QAAQ,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,QAAQ,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;AACtE,QAAQ,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM;AAC1D,aAAa,KAAK,CAAC,EAAE;AACrB,aAAa,GAAG,CAAC,CAAC,CAAC,KAAK;AACxB,YAAY,OAAO,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;AACxE,QAAQ,CAAC;AACT,aAAa,IAAI,CAAC,EAAE,CAAC,CAAC;AACtB,QAAQ,OAAO,IAAI,CAAC,KAAK,CAAC,WA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BAAgB,MAAM,IAAI,KAAK,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AACrF;AACA,IAAI;AACJ,IAAI,MAAM,oBAAoB,CAAC,OAAO,EAAE;AACxC,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,2BAA2B,EAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;AACxF,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;AACA,cAAc,CAAC,eAAe,GAAG,4BAA4B;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -60,10 +60,10 @@ var capacitorCapacitorUpdater = (function (exports, core) {
60
60
  throw new Error('Apple Sign-In script not loaded.');
61
61
  }
62
62
  return new Promise((resolve, reject) => {
63
- var _a;
63
+ var _a, _b;
64
64
  AppleID.auth.init({
65
- clientId: this.clientId,
66
- scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',
65
+ clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : '',
66
+ scope: ((_b = options.scopes) === null || _b === void 0 ? void 0 : _b.join(' ')) || 'name email',
67
67
  redirectURI: this.redirectUrl || window.location.href,
68
68
  state: options.state,
69
69
  nonce: options.nonce,
@@ -204,7 +204,7 @@ var capacitorCapacitorUpdater = (function (exports, core) {
204
204
  FB.getLoginStatus((response) => {
205
205
  var _a;
206
206
  if (response.status === 'connected') {
207
- resolve({ jwt: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || '' });
207
+ resolve({ accessToken: ((_a = response.authResponse) === null || _a === void 0 ? void 0 : _a.accessToken) || '' });
208
208
  }
209
209
  else {
210
210
  reject(new Error('No Facebook authorization code available'));
@@ -502,8 +502,9 @@ var capacitorCapacitorUpdater = (function (exports, core) {
502
502
  }
503
503
  }
504
504
  async traditionalOAuth({ scopes, hostedDomain, nonce, prompt, }) {
505
+ var _a;
505
506
  const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];
506
- const params = new URLSearchParams(Object.assign(Object.assign({ client_id: this.clientId, redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));
507
+ const params = new URLSearchParams(Object.assign(Object.assign({ client_id: (_a = this.clientId) !== null && _a !== void 0 ? _a : '', redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));
507
508
  if (hostedDomain !== undefined) {
508
509
  params.append('hd', hostedDomain);
509
510
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/base.js","esm/apple-provider.js","esm/facebook-provider.js","esm/google-provider.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 BaseSocialLogin extends WebPlugin {\n constructor() {\n super();\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 loadScript(src) {\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n script.onload = () => {\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n}\nBaseSocialLogin.OAUTH_STATE_KEY = 'social_login_oauth_pending';\n//# sourceMappingURL=base.js.map","import { BaseSocialLogin } from './base';\nexport class AppleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.redirectUrl = null;\n this.scriptLoaded = false;\n this.scriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n this.useProperTokenExchange = false;\n }\n async initialize(clientId, redirectUrl, useProperTokenExchange = false) {\n this.clientId = clientId;\n this.redirectUrl = redirectUrl || null;\n this.useProperTokenExchange = useProperTokenExchange;\n if (clientId) {\n await this.loadAppleScript();\n }\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n if (!this.scriptLoaded) {\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.clientId,\n scope: ((_a = options.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) || 'name email',\n redirectURI: this.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;\n let accessToken = null;\n if (this.useProperTokenExchange) {\n // When using proper token exchange, the authorization code should be exchanged\n // for a proper access token on the backend. For now, we set accessToken to null\n // and provide the authorization code in a separate field for backend processing.\n accessToken = null;\n }\n else {\n // Legacy behavior: use authorization code as access token for backward compatibility\n accessToken = {\n token: res.authorization.code || '',\n };\n }\n const result = Object.assign({ profile: {\n user: res.user || '',\n email: ((_a = res.user) === null || _a === void 0 ? void 0 : _a.email) || null,\n givenName: ((_c = (_b = res.user) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.firstName) || null,\n familyName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.lastName) || null,\n }, accessToken: accessToken, idToken: res.authorization.id_token || null }, (this.useProperTokenExchange && { authorizationCode: res.authorization.code }));\n resolve({ provider: 'apple', result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async logout() {\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n }\n async isLoggedIn() {\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 }\n async getAuthorizationCode() {\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 }\n async refresh() {\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n }\n async loadAppleScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript(this.scriptUrl).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=apple-provider.js.map","import { BaseSocialLogin } from './base';\nexport class FacebookSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.appId = null;\n this.scriptLoaded = false;\n this.locale = 'en_US';\n }\n async initialize(appId, locale) {\n this.appId = appId;\n if (locale) {\n this.locale = locale;\n }\n if (appId) {\n // Load with the specified locale or default\n await this.loadFacebookScript(this.locale);\n FB.init({\n appId: this.appId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n }\n async login(options) {\n if (!this.appId) {\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 logout() {\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n }\n async isLoggedIn() {\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n }\n async getAuthorizationCode() {\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 }\n async refresh(options) {\n await this.login(options);\n }\n async loadFacebookScript(locale) {\n if (this.scriptLoaded)\n return;\n // Remove any existing Facebook SDK script\n const existingScript = document.querySelector('script[src*=\"connect.facebook.net\"]');\n if (existingScript) {\n existingScript.remove();\n }\n return this.loadScript(`https://connect.facebook.net/${locale}/sdk.js`).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=facebook-provider.js.map","import { BaseSocialLogin } from './base';\nexport class GoogleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.loginType = 'online';\n this.GOOGLE_TOKEN_REQUEST_URL = 'https://www.googleapis.com/oauth2/v3/tokeninfo';\n this.GOOGLE_STATE_KEY = 'capgo_social_login_google_state';\n }\n async initialize(clientId, mode, hostedDomain, redirectUrl) {\n this.clientId = clientId;\n if (mode) {\n this.loginType = mode;\n }\n this.hostedDomain = hostedDomain;\n this.redirectUrl = redirectUrl;\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n let scopes = options.scopes || [];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.email')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.email');\n }\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.profile')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.profile');\n }\n if (!scopes.includes('openid')) {\n scopes.push('openid');\n }\n }\n else {\n scopes = [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ];\n }\n const nonce = options.nonce || Math.random().toString(36).substring(2);\n // If scopes are provided, directly use the traditional OAuth flow\n return this.traditionalOAuth({\n scopes,\n nonce,\n hostedDomain: this.hostedDomain,\n prompt: options.prompt,\n });\n }\n async logout() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. logout is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return;\n await this.rawLogoutGoogle(state.accessToken);\n }\n async isLoggedIn() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. isLoggedIn is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return { isLoggedIn: false };\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { isLoggedIn: true };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n return { isLoggedIn: false };\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async getAuthorizationCode() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. getAuthorizationCode is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n throw new Error('No Google authorization code available');\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { accessToken: state.accessToken, jwt: state.idToken };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n throw new Error('No Google authorization code available');\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async refresh() {\n // For Google, we can prompt for re-authentication\n return Promise.reject('Not implemented');\n }\n handleOAuthRedirect(url) {\n const paramsRaw = url.searchParams;\n const code = paramsRaw.get('code');\n if (code && paramsRaw.has('scope')) {\n return {\n provider: 'google',\n result: {\n serverAuthCode: code,\n responseType: 'offline',\n },\n };\n }\n const hash = url.hash.substring(1);\n console.log('handleOAuthRedirect', url.hash);\n if (!hash)\n return null;\n console.log('handleOAuthRedirect ok');\n const params = new URLSearchParams(hash);\n const accessToken = params.get('access_token');\n const idToken = params.get('id_token');\n if (accessToken && idToken) {\n localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);\n const profile = this.parseJwt(idToken);\n return {\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n };\n }\n return null;\n }\n async accessTokenIsValid(accessToken) {\n const url = `${this.GOOGLE_TOKEN_REQUEST_URL}?access_token=${encodeURIComponent(accessToken)}`;\n try {\n // Make the GET request using fetch\n const response = await fetch(url);\n // Check if the response is successful\n if (!response.ok) {\n console.log(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response not successful. Status code: ${response.status}. Assuming that the token is not valid`);\n return false;\n }\n // Get the response body as text\n const responseBody = await response.text();\n if (!responseBody) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n }\n // Parse the response body as JSON\n let jsonObject;\n try {\n jsonObject = JSON.parse(responseBody);\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n }\n // Extract the 'expires_in' field\n const expiresInStr = jsonObject['expires_in'];\n if (expiresInStr === undefined || expiresInStr === null) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n }\n // Parse 'expires_in' as an integer\n let expiresInInt;\n try {\n expiresInInt = parseInt(expiresInStr, 10);\n if (isNaN(expiresInInt)) {\n throw new Error(`'expires_in' is not a valid integer`);\n }\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n }\n // Determine if the access token is valid based on 'expires_in'\n return expiresInInt > 5;\n }\n catch (error) {\n console.error(error);\n throw error;\n }\n }\n idTokenValid(idToken) {\n try {\n const parsed = this.parseJwt(idToken);\n const currentTime = Math.ceil(Date.now() / 1000) + 5; // Convert current time to seconds since epoch\n return parsed.exp && currentTime < parsed.exp;\n }\n catch (e) {\n return false;\n }\n }\n async rawLogoutGoogle(accessToken, tokenValid = null) {\n if (tokenValid === null) {\n tokenValid = await this.accessTokenIsValid(accessToken);\n }\n if (tokenValid === true) {\n try {\n await fetch(`https://accounts.google.com/o/oauth2/revoke?token=${encodeURIComponent(accessToken)}`);\n this.clearStateGoogle();\n }\n catch (e) {\n // ignore\n }\n return;\n }\n else {\n this.clearStateGoogle();\n return;\n }\n }\n persistStateGoogle(accessToken, idToken) {\n try {\n window.localStorage.setItem(this.GOOGLE_STATE_KEY, JSON.stringify({ accessToken, idToken }));\n }\n catch (e) {\n console.error('Cannot persist state google', e);\n }\n }\n clearStateGoogle() {\n try {\n window.localStorage.removeItem(this.GOOGLE_STATE_KEY);\n }\n catch (e) {\n console.error('Cannot clear state google', e);\n }\n }\n getGoogleState() {\n try {\n const state = window.localStorage.getItem(this.GOOGLE_STATE_KEY);\n if (!state)\n return null;\n const { accessToken, idToken } = JSON.parse(state);\n return { accessToken, idToken };\n }\n catch (e) {\n console.error('Cannot get state google', e);\n return null;\n }\n }\n async traditionalOAuth({ scopes, hostedDomain, nonce, prompt, }) {\n const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];\n const params = new URLSearchParams(Object.assign(Object.assign({ client_id: this.clientId, redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));\n if (hostedDomain !== undefined) {\n params.append('hd', hostedDomain);\n }\n if (prompt !== undefined) {\n params.append('prompt', prompt);\n }\n const url = `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;\n const width = 500;\n const height = 600;\n const left = window.screenX + (window.outerWidth - width) / 2;\n const top = window.screenY + (window.outerHeight - height) / 2;\n localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, 'true');\n const popup = window.open(url, 'Google Sign In', `width=${width},height=${height},left=${left},top=${top},popup=1`);\n let popupClosedInterval;\n let timeoutHandle;\n // This may never return...\n return new Promise((resolve, reject) => {\n if (!popup) {\n reject(new Error('Failed to open popup'));\n return;\n }\n const handleMessage = (event) => {\n var _a, _b, _c;\n if (event.origin !== window.location.origin || ((_b = (_a = event.data) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.startsWith('angular')))\n return;\n if (((_c = event.data) === null || _c === void 0 ? void 0 : _c.type) === 'oauth-response') {\n window.removeEventListener('message', handleMessage);\n clearInterval(popupClosedInterval);\n if (this.loginType === 'online') {\n const { accessToken, idToken } = event.data;\n if (accessToken && idToken) {\n const profile = this.parseJwt(idToken);\n this.persistStateGoogle(accessToken.token, idToken);\n resolve({\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken.token,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n });\n }\n }\n else {\n const { serverAuthCode } = event.data;\n resolve({\n provider: 'google',\n result: {\n responseType: 'offline',\n serverAuthCode,\n },\n });\n }\n }\n // Don't reject for non-OAuth messages, just ignore them\n };\n window.addEventListener('message', handleMessage);\n // Timeout after 5 minutes\n timeoutHandle = setTimeout(() => {\n clearTimeout(timeoutHandle);\n window.removeEventListener('message', handleMessage);\n popup.close();\n reject(new Error('OAuth timeout'));\n }, 300000);\n popupClosedInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(popupClosedInterval);\n reject(new Error('Popup closed'));\n }\n }, 1000);\n });\n }\n}\n//# sourceMappingURL=google-provider.js.map","import { WebPlugin } from '@capacitor/core';\nimport { AppleSocialLogin } from './apple-provider';\nimport { FacebookSocialLogin } from './facebook-provider';\nimport { GoogleSocialLogin } from './google-provider';\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n var _a;\n super();\n this.googleProvider = new GoogleSocialLogin();\n this.appleProvider = new AppleSocialLogin();\n this.facebookProvider = new FacebookSocialLogin();\n // Set up listener for OAuth redirects if we have a pending OAuth flow\n if (localStorage.getItem(SocialLoginWeb.OAUTH_STATE_KEY)) {\n console.log('OAUTH_STATE_KEY found');\n const result = this.handleOAuthRedirect();\n if (result) {\n (_a = window.opener) === null || _a === void 0 ? void 0 : _a.postMessage(Object.assign({ type: 'oauth-response' }, result.result), window.location.origin);\n window.close();\n }\n }\n }\n handleOAuthRedirect() {\n const url = new URL(window.location.href);\n return this.googleProvider.handleOAuthRedirect(url);\n }\n async initialize(options) {\n var _a, _b, _c;\n const initPromises = [];\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n initPromises.push(this.googleProvider.initialize(options.google.webClientId, options.google.mode, options.google.hostedDomain, options.google.redirectUrl));\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n initPromises.push(this.appleProvider.initialize(options.apple.clientId, options.apple.redirectUrl, options.apple.useProperTokenExchange));\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n initPromises.push(this.facebookProvider.initialize(options.facebook.appId, options.facebook.locale));\n }\n await Promise.all(initPromises);\n }\n async login(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.login(options.options);\n case 'apple':\n return this.appleProvider.login(options.options);\n case 'facebook':\n return this.facebookProvider.login(options.options);\n default:\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n }\n async logout(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.logout();\n case 'apple':\n return this.appleProvider.logout();\n case 'facebook':\n return this.facebookProvider.logout();\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 return this.googleProvider.isLoggedIn();\n case 'apple':\n return this.appleProvider.isLoggedIn();\n case 'facebook':\n return this.facebookProvider.isLoggedIn();\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 return this.googleProvider.getAuthorizationCode();\n case 'apple':\n return this.appleProvider.getAuthorizationCode();\n case 'facebook':\n return this.facebookProvider.getAuthorizationCode();\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 return this.googleProvider.refresh();\n case 'apple':\n return this.appleProvider.refresh();\n case 'facebook':\n return this.facebookProvider.refresh(options.options);\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async providerSpecificCall(options) {\n throw new Error(`Provider specific call for ${options.call} is not implemented`);\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\nSocialLoginWeb.OAUTH_STATE_KEY = 'social_login_oauth_p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index.js","esm/base.js","esm/apple-provider.js","esm/facebook-provider.js","esm/google-provider.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 BaseSocialLogin extends WebPlugin {\n constructor() {\n super();\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 loadScript(src) {\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n script.onload = () => {\n resolve();\n };\n script.onerror = reject;\n document.body.appendChild(script);\n });\n }\n}\nBaseSocialLogin.OAUTH_STATE_KEY = 'social_login_oauth_pending';\n//# sourceMappingURL=base.js.map","import { BaseSocialLogin } from './base';\nexport class AppleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.redirectUrl = null;\n this.scriptLoaded = false;\n this.scriptUrl = 'https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js';\n this.useProperTokenExchange = false;\n }\n async initialize(clientId, redirectUrl, useProperTokenExchange = false) {\n this.clientId = clientId;\n this.redirectUrl = redirectUrl || null;\n this.useProperTokenExchange = useProperTokenExchange;\n if (clientId) {\n await this.loadAppleScript();\n }\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Apple Client ID not set. Call initialize() first.');\n }\n if (!this.scriptLoaded) {\n throw new Error('Apple Sign-In script not loaded.');\n }\n return new Promise((resolve, reject) => {\n var _a, _b;\n AppleID.auth.init({\n clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : '',\n scope: ((_b = options.scopes) === null || _b === void 0 ? void 0 : _b.join(' ')) || 'name email',\n redirectURI: this.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;\n let accessToken = null;\n if (this.useProperTokenExchange) {\n // When using proper token exchange, the authorization code should be exchanged\n // for a proper access token on the backend. For now, we set accessToken to null\n // and provide the authorization code in a separate field for backend processing.\n accessToken = null;\n }\n else {\n // Legacy behavior: use authorization code as access token for backward compatibility\n accessToken = {\n token: res.authorization.code || '',\n };\n }\n const result = Object.assign({ profile: {\n user: res.user || '',\n email: ((_a = res.user) === null || _a === void 0 ? void 0 : _a.email) || null,\n givenName: ((_c = (_b = res.user) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.firstName) || null,\n familyName: ((_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.lastName) || null,\n }, accessToken: accessToken, idToken: res.authorization.id_token || null }, (this.useProperTokenExchange && { authorizationCode: res.authorization.code }));\n resolve({ provider: 'apple', result });\n })\n .catch((error) => {\n reject(error);\n });\n });\n }\n async logout() {\n // Apple doesn't provide a logout method for web\n console.log('Apple logout: Session should be managed on the client side');\n }\n async isLoggedIn() {\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 }\n async getAuthorizationCode() {\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 }\n async refresh() {\n // Apple doesn't provide a refresh method for web\n console.log('Apple refresh not available on web');\n }\n async loadAppleScript() {\n if (this.scriptLoaded)\n return;\n return this.loadScript(this.scriptUrl).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=apple-provider.js.map","import { BaseSocialLogin } from './base';\nexport class FacebookSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.appId = null;\n this.scriptLoaded = false;\n this.locale = 'en_US';\n }\n async initialize(appId, locale) {\n this.appId = appId;\n if (locale) {\n this.locale = locale;\n }\n if (appId) {\n // Load with the specified locale or default\n await this.loadFacebookScript(this.locale);\n FB.init({\n appId: this.appId,\n version: 'v17.0',\n xfbml: true,\n cookie: true,\n });\n }\n }\n async login(options) {\n if (!this.appId) {\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 logout() {\n return new Promise((resolve) => {\n FB.logout(() => resolve());\n });\n }\n async isLoggedIn() {\n return new Promise((resolve) => {\n FB.getLoginStatus((response) => {\n resolve({ isLoggedIn: response.status === 'connected' });\n });\n });\n }\n async getAuthorizationCode() {\n return new Promise((resolve, reject) => {\n FB.getLoginStatus((response) => {\n var _a;\n if (response.status === 'connected') {\n resolve({ accessToken: ((_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 }\n async refresh(options) {\n await this.login(options);\n }\n async loadFacebookScript(locale) {\n if (this.scriptLoaded)\n return;\n // Remove any existing Facebook SDK script\n const existingScript = document.querySelector('script[src*=\"connect.facebook.net\"]');\n if (existingScript) {\n existingScript.remove();\n }\n return this.loadScript(`https://connect.facebook.net/${locale}/sdk.js`).then(() => {\n this.scriptLoaded = true;\n });\n }\n}\n//# sourceMappingURL=facebook-provider.js.map","import { BaseSocialLogin } from './base';\nexport class GoogleSocialLogin extends BaseSocialLogin {\n constructor() {\n super(...arguments);\n this.clientId = null;\n this.loginType = 'online';\n this.GOOGLE_TOKEN_REQUEST_URL = 'https://www.googleapis.com/oauth2/v3/tokeninfo';\n this.GOOGLE_STATE_KEY = 'capgo_social_login_google_state';\n }\n async initialize(clientId, mode, hostedDomain, redirectUrl) {\n this.clientId = clientId;\n if (mode) {\n this.loginType = mode;\n }\n this.hostedDomain = hostedDomain;\n this.redirectUrl = redirectUrl;\n }\n async login(options) {\n if (!this.clientId) {\n throw new Error('Google Client ID not set. Call initialize() first.');\n }\n let scopes = options.scopes || [];\n if (scopes.length > 0) {\n // If scopes are provided, directly use the traditional OAuth flow\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.email')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.email');\n }\n if (!scopes.includes('https://www.googleapis.com/auth/userinfo.profile')) {\n scopes.push('https://www.googleapis.com/auth/userinfo.profile');\n }\n if (!scopes.includes('openid')) {\n scopes.push('openid');\n }\n }\n else {\n scopes = [\n 'https://www.googleapis.com/auth/userinfo.email',\n 'https://www.googleapis.com/auth/userinfo.profile',\n 'openid',\n ];\n }\n const nonce = options.nonce || Math.random().toString(36).substring(2);\n // If scopes are provided, directly use the traditional OAuth flow\n return this.traditionalOAuth({\n scopes,\n nonce,\n hostedDomain: this.hostedDomain,\n prompt: options.prompt,\n });\n }\n async logout() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. logout is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return;\n await this.rawLogoutGoogle(state.accessToken);\n }\n async isLoggedIn() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. isLoggedIn is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n return { isLoggedIn: false };\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { isLoggedIn: true };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n return { isLoggedIn: false };\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async getAuthorizationCode() {\n if (this.loginType === 'offline') {\n return Promise.reject(\"Offline login doesn't store tokens. getAuthorizationCode is not available\");\n }\n // eslint-disable-next-line\n const state = this.getGoogleState();\n if (!state)\n throw new Error('No Google authorization code available');\n try {\n const isValidAccessToken = await this.accessTokenIsValid(state.accessToken);\n const isValidIdToken = this.idTokenValid(state.idToken);\n if (isValidAccessToken && isValidIdToken) {\n return { accessToken: state.accessToken, jwt: state.idToken };\n }\n else {\n try {\n await this.rawLogoutGoogle(state.accessToken, false);\n }\n catch (e) {\n console.error('Access token is not valid, but cannot logout', e);\n }\n throw new Error('No Google authorization code available');\n }\n }\n catch (e) {\n return Promise.reject(e);\n }\n }\n async refresh() {\n // For Google, we can prompt for re-authentication\n return Promise.reject('Not implemented');\n }\n handleOAuthRedirect(url) {\n const paramsRaw = url.searchParams;\n const code = paramsRaw.get('code');\n if (code && paramsRaw.has('scope')) {\n return {\n provider: 'google',\n result: {\n serverAuthCode: code,\n responseType: 'offline',\n },\n };\n }\n const hash = url.hash.substring(1);\n console.log('handleOAuthRedirect', url.hash);\n if (!hash)\n return null;\n console.log('handleOAuthRedirect ok');\n const params = new URLSearchParams(hash);\n const accessToken = params.get('access_token');\n const idToken = params.get('id_token');\n if (accessToken && idToken) {\n localStorage.removeItem(BaseSocialLogin.OAUTH_STATE_KEY);\n const profile = this.parseJwt(idToken);\n return {\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n };\n }\n return null;\n }\n async accessTokenIsValid(accessToken) {\n const url = `${this.GOOGLE_TOKEN_REQUEST_URL}?access_token=${encodeURIComponent(accessToken)}`;\n try {\n // Make the GET request using fetch\n const response = await fetch(url);\n // Check if the response is successful\n if (!response.ok) {\n console.log(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response not successful. Status code: ${response.status}. Assuming that the token is not valid`);\n return false;\n }\n // Get the response body as text\n const responseBody = await response.text();\n if (!responseBody) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is null`);\n }\n // Parse the response body as JSON\n let jsonObject;\n try {\n jsonObject = JSON.parse(responseBody);\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response body is not valid JSON. Error: ${e}`);\n }\n // Extract the 'expires_in' field\n const expiresInStr = jsonObject['expires_in'];\n if (expiresInStr === undefined || expiresInStr === null) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. Response JSON does not include 'expires_in'.`);\n }\n // Parse 'expires_in' as an integer\n let expiresInInt;\n try {\n expiresInInt = parseInt(expiresInStr, 10);\n if (isNaN(expiresInInt)) {\n throw new Error(`'expires_in' is not a valid integer`);\n }\n }\n catch (e) {\n console.error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n throw new Error(`Invalid response from ${this.GOOGLE_TOKEN_REQUEST_URL}. 'expires_in': ${expiresInStr} is not a valid integer. Error: ${e}`);\n }\n // Determine if the access token is valid based on 'expires_in'\n return expiresInInt > 5;\n }\n catch (error) {\n console.error(error);\n throw error;\n }\n }\n idTokenValid(idToken) {\n try {\n const parsed = this.parseJwt(idToken);\n const currentTime = Math.ceil(Date.now() / 1000) + 5; // Convert current time to seconds since epoch\n return parsed.exp && currentTime < parsed.exp;\n }\n catch (e) {\n return false;\n }\n }\n async rawLogoutGoogle(accessToken, tokenValid = null) {\n if (tokenValid === null) {\n tokenValid = await this.accessTokenIsValid(accessToken);\n }\n if (tokenValid === true) {\n try {\n await fetch(`https://accounts.google.com/o/oauth2/revoke?token=${encodeURIComponent(accessToken)}`);\n this.clearStateGoogle();\n }\n catch (e) {\n // ignore\n }\n return;\n }\n else {\n this.clearStateGoogle();\n return;\n }\n }\n persistStateGoogle(accessToken, idToken) {\n try {\n window.localStorage.setItem(this.GOOGLE_STATE_KEY, JSON.stringify({ accessToken, idToken }));\n }\n catch (e) {\n console.error('Cannot persist state google', e);\n }\n }\n clearStateGoogle() {\n try {\n window.localStorage.removeItem(this.GOOGLE_STATE_KEY);\n }\n catch (e) {\n console.error('Cannot clear state google', e);\n }\n }\n getGoogleState() {\n try {\n const state = window.localStorage.getItem(this.GOOGLE_STATE_KEY);\n if (!state)\n return null;\n const { accessToken, idToken } = JSON.parse(state);\n return { accessToken, idToken };\n }\n catch (e) {\n console.error('Cannot get state google', e);\n return null;\n }\n }\n async traditionalOAuth({ scopes, hostedDomain, nonce, prompt, }) {\n var _a;\n const uniqueScopes = [...new Set([...(scopes || []), 'openid'])];\n const params = new URLSearchParams(Object.assign(Object.assign({ client_id: (_a = this.clientId) !== null && _a !== void 0 ? _a : '', redirect_uri: this.redirectUrl || window.location.origin + window.location.pathname, response_type: this.loginType === 'offline' ? 'code' : 'token id_token', scope: uniqueScopes.join(' ') }, (nonce && { nonce })), { include_granted_scopes: 'true', state: 'popup' }));\n if (hostedDomain !== undefined) {\n params.append('hd', hostedDomain);\n }\n if (prompt !== undefined) {\n params.append('prompt', prompt);\n }\n const url = `https://accounts.google.com/o/oauth2/v2/auth?${params.toString()}`;\n const width = 500;\n const height = 600;\n const left = window.screenX + (window.outerWidth - width) / 2;\n const top = window.screenY + (window.outerHeight - height) / 2;\n localStorage.setItem(BaseSocialLogin.OAUTH_STATE_KEY, 'true');\n const popup = window.open(url, 'Google Sign In', `width=${width},height=${height},left=${left},top=${top},popup=1`);\n let popupClosedInterval;\n let timeoutHandle;\n // This may never return...\n return new Promise((resolve, reject) => {\n if (!popup) {\n reject(new Error('Failed to open popup'));\n return;\n }\n const handleMessage = (event) => {\n var _a, _b, _c;\n if (event.origin !== window.location.origin || ((_b = (_a = event.data) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.startsWith('angular')))\n return;\n if (((_c = event.data) === null || _c === void 0 ? void 0 : _c.type) === 'oauth-response') {\n window.removeEventListener('message', handleMessage);\n clearInterval(popupClosedInterval);\n if (this.loginType === 'online') {\n const { accessToken, idToken } = event.data;\n if (accessToken && idToken) {\n const profile = this.parseJwt(idToken);\n this.persistStateGoogle(accessToken.token, idToken);\n resolve({\n provider: 'google',\n result: {\n accessToken: {\n token: accessToken.token,\n },\n idToken,\n profile: {\n email: profile.email || null,\n familyName: profile.family_name || null,\n givenName: profile.given_name || null,\n id: profile.sub || null,\n name: profile.name || null,\n imageUrl: profile.picture || null,\n },\n responseType: 'online',\n },\n });\n }\n }\n else {\n const { serverAuthCode } = event.data;\n resolve({\n provider: 'google',\n result: {\n responseType: 'offline',\n serverAuthCode,\n },\n });\n }\n }\n // Don't reject for non-OAuth messages, just ignore them\n };\n window.addEventListener('message', handleMessage);\n // Timeout after 5 minutes\n timeoutHandle = setTimeout(() => {\n clearTimeout(timeoutHandle);\n window.removeEventListener('message', handleMessage);\n popup.close();\n reject(new Error('OAuth timeout'));\n }, 300000);\n popupClosedInterval = setInterval(() => {\n if (popup.closed) {\n clearInterval(popupClosedInterval);\n reject(new Error('Popup closed'));\n }\n }, 1000);\n });\n }\n}\n//# sourceMappingURL=google-provider.js.map","import { WebPlugin } from '@capacitor/core';\nimport { AppleSocialLogin } from './apple-provider';\nimport { FacebookSocialLogin } from './facebook-provider';\nimport { GoogleSocialLogin } from './google-provider';\nexport class SocialLoginWeb extends WebPlugin {\n constructor() {\n var _a;\n super();\n this.googleProvider = new GoogleSocialLogin();\n this.appleProvider = new AppleSocialLogin();\n this.facebookProvider = new FacebookSocialLogin();\n // Set up listener for OAuth redirects if we have a pending OAuth flow\n if (localStorage.getItem(SocialLoginWeb.OAUTH_STATE_KEY)) {\n console.log('OAUTH_STATE_KEY found');\n const result = this.handleOAuthRedirect();\n if (result) {\n (_a = window.opener) === null || _a === void 0 ? void 0 : _a.postMessage(Object.assign({ type: 'oauth-response' }, result.result), window.location.origin);\n window.close();\n }\n }\n }\n handleOAuthRedirect() {\n const url = new URL(window.location.href);\n return this.googleProvider.handleOAuthRedirect(url);\n }\n async initialize(options) {\n var _a, _b, _c;\n const initPromises = [];\n if ((_a = options.google) === null || _a === void 0 ? void 0 : _a.webClientId) {\n initPromises.push(this.googleProvider.initialize(options.google.webClientId, options.google.mode, options.google.hostedDomain, options.google.redirectUrl));\n }\n if ((_b = options.apple) === null || _b === void 0 ? void 0 : _b.clientId) {\n initPromises.push(this.appleProvider.initialize(options.apple.clientId, options.apple.redirectUrl, options.apple.useProperTokenExchange));\n }\n if ((_c = options.facebook) === null || _c === void 0 ? void 0 : _c.appId) {\n initPromises.push(this.facebookProvider.initialize(options.facebook.appId, options.facebook.locale));\n }\n await Promise.all(initPromises);\n }\n async login(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.login(options.options);\n case 'apple':\n return this.appleProvider.login(options.options);\n case 'facebook':\n return this.facebookProvider.login(options.options);\n default:\n throw new Error(`Login for ${options.provider} is not implemented on web`);\n }\n }\n async logout(options) {\n switch (options.provider) {\n case 'google':\n return this.googleProvider.logout();\n case 'apple':\n return this.appleProvider.logout();\n case 'facebook':\n return this.facebookProvider.logout();\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 return this.googleProvider.isLoggedIn();\n case 'apple':\n return this.appleProvider.isLoggedIn();\n case 'facebook':\n return this.facebookProvider.isLoggedIn();\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 return this.googleProvider.getAuthorizationCode();\n case 'apple':\n return this.appleProvider.getAuthorizationCode();\n case 'facebook':\n return this.facebookProvider.getAuthorizationCode();\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 return this.googleProvider.refresh();\n case 'apple':\n return this.appleProvider.refresh();\n case 'facebook':\n return this.facebookProvider.refresh(options.options);\n default:\n throw new Error(`Refresh for ${options.provider} is not implemented`);\n }\n }\n async providerSpecificCall(options) {\n throw new Error(`Provider specific call for ${options.call} is not implemented`);\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\nSocialLoginWeb.OAUTH_STATE_KEY = 'social_login_oauth_pending';\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,eAAe,SAASC,cAAS,CAAC;IAC/C,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,EAAE;IACf,IAAI;IACJ,IAAI,QAAQ,CAAC,KAAK,EAAE;IACpB,QAAQ,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7C,QAAQ,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,C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AC,CAAC,yBAAyB,EAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IAClG;IACA,IAAI;IACJ,IAAI,MAAM,OAAO,CAAC,OAAO,EAAE;IAC3B,QAAQ,QAAQ,OAAO,CAAC,QAAQ;IAChC,YAAY,KAAK,QAAQ;IACzB,gBAAgB,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;IACpD,YAAY,KAAK,OAAO;IACxB,gBAAgB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE;IACnD,YAAY,KAAK,UAAU;IAC3B,gBAAgB,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;IACrE,YAAY;IACZ,gBAAgB,MAAM,IAAI,KAAK,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IACrF;IACA,IAAI;IACJ,IAAI,MAAM,oBAAoB,CAAC,OAAO,EAAE;IACxC,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,2BAA2B,EAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACxF,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ;IACA,cAAc,CAAC,eAAe,GAAG,4BAA4B;;;;;;;;;;;;;;;"}
@@ -215,4 +215,18 @@ class FacebookProvider {
215
215
  }
216
216
  }
217
217
  }
218
+
219
+ func getAuthorizationCode(completion: @escaping (Result<(accessToken: String?, jwt: String?), Error>) -> Void) {
220
+ // First check if access token exists and is not expired
221
+ if let accessToken = AccessToken.current, !accessToken.isExpired {
222
+ // User is connected with access token, return it
223
+ completion(.success((accessToken: accessToken.tokenString, jwt: nil)))
224
+ } else if let authToken = AuthenticationToken.current, !authToken.tokenString.isEmpty {
225
+ // Access token not found but idToken (JWT) is available, return JWT
226
+ completion(.success((accessToken: nil, jwt: authToken.tokenString)))
227
+ } else {
228
+ // Neither access token nor idToken available
229
+ completion(.failure(NSError(domain: "FacebookProvider", code: 0, userInfo: [NSLocalizedDescriptionKey: "No Facebook authorization code available"])))
230
+ }
231
+ }
218
232
  }
@@ -7,7 +7,7 @@ import Capacitor
7
7
  */
8
8
  @objc(SocialLoginPlugin)
9
9
  public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
10
- private let pluginVersion: String = "7.14.11"
10
+ private let pluginVersion: String = "7.15.2"
11
11
  public let identifier = "SocialLoginPlugin"
12
12
  public let jsName = "SocialLogin"
13
13
  public let pluginMethods: [CAPPluginMethod] = [
@@ -106,6 +106,23 @@ public class SocialLoginPlugin: CAPPlugin, CAPBridgedPlugin {
106
106
  }
107
107
  }
108
108
  }
109
+ case "facebook": do {
110
+ self.facebook.getAuthorizationCode { res in
111
+ do {
112
+ let result = try res.get()
113
+ var response: [String: String] = [:]
114
+ if let accessToken = result.accessToken {
115
+ response["accessToken"] = accessToken
116
+ }
117
+ if let jwt = result.jwt {
118
+ response["jwt"] = jwt
119
+ }
120
+ call.resolve(response)
121
+ } catch {
122
+ call.reject(error.localizedDescription)
123
+ }
124
+ }
125
+ }
109
126
  default:
110
127
  call.reject("Invalid provider")
111
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-social-login",
3
- "version": "7.14.11",
3
+ "version": "7.15.2",
4
4
  "description": "All social logins in one plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -56,8 +56,6 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@capacitor/android": "^7.0.0",
59
- "@capacitor/cli": "^7.0.0",
60
- "@capacitor/core": "^7.0.0",
61
59
  "@capacitor/docgen": "^0.3.0",
62
60
  "@capacitor/ios": "^7.0.0",
63
61
  "@ionic/eslint-config": "^0.4.0",
@@ -89,5 +87,6 @@
89
87
  "android": {
90
88
  "src": "android"
91
89
  }
92
- }
90
+ },
91
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
93
92
  }