@capgo/capacitor-social-login 0.0.71 → 0.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -421,7 +421,6 @@ Refresh the access token
|
|
|
421
421
|
| **`scopes`** | <code>string[]</code> | Specifies the scopes required for accessing Google APIs The default is defined in the configuration. | | |
|
|
422
422
|
| **`nonce`** | <code>string</code> | Nonce | | |
|
|
423
423
|
| **`grantOfflineAccess`** | <code>boolean</code> | Set if your application needs to refresh access tokens when the user is not present at the browser. In response use `serverAuthCode` key | <code>false</code> | 0.0.69 |
|
|
424
|
-
| **`newUI`** | <code>boolean</code> | New UI | <code>false</code> | 0.1.0 |
|
|
425
424
|
|
|
426
425
|
|
|
427
426
|
#### AppleProviderOptions
|
|
@@ -103,77 +103,40 @@ public class GoogleProvider implements SocialProvider {
|
|
|
103
103
|
this.scopes = new String[] { "profile", "email" };
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
GetSignInWithGoogleOption.Builder
|
|
108
|
-
new GetSignInWithGoogleOption.Builder(this.clientId);
|
|
106
|
+
GetSignInWithGoogleOption.Builder googleIdOptionBuilder =
|
|
107
|
+
new GetSignInWithGoogleOption.Builder(this.clientId);
|
|
109
108
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
if (nonce != null && !nonce.isEmpty()) {
|
|
110
|
+
googleIdOptionBuilder.setNonce(nonce);
|
|
111
|
+
}
|
|
113
112
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Executor executor = Executors.newSingleThreadExecutor();
|
|
121
|
-
credentialManager.getCredentialAsync(
|
|
122
|
-
context,
|
|
123
|
-
filteredRequest,
|
|
124
|
-
null,
|
|
125
|
-
executor,
|
|
126
|
-
new CredentialManagerCallback<
|
|
127
|
-
GetCredentialResponse,
|
|
128
|
-
GetCredentialException
|
|
129
|
-
>() {
|
|
130
|
-
@Override
|
|
131
|
-
public void onResult(GetCredentialResponse result) {
|
|
132
|
-
handleSignInResult(result, call);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
@Override
|
|
136
|
-
public void onError(GetCredentialException e) {
|
|
137
|
-
handleSignInError(e, call);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
);
|
|
141
|
-
} else {
|
|
142
|
-
GetSignInWithGoogleOption.Builder googleIdOptionBuilder =
|
|
143
|
-
new GetSignInWithGoogleOption.Builder(this.clientId);
|
|
113
|
+
GetSignInWithGoogleOption googleIdOptionFiltered =
|
|
114
|
+
googleIdOptionBuilder.build();
|
|
115
|
+
GetCredentialRequest filteredRequest = new GetCredentialRequest.Builder()
|
|
116
|
+
.addCredentialOption(googleIdOptionFiltered)
|
|
117
|
+
.build();
|
|
144
118
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
119
|
+
Executor executor = Executors.newSingleThreadExecutor();
|
|
120
|
+
credentialManager.getCredentialAsync(
|
|
121
|
+
context,
|
|
122
|
+
filteredRequest,
|
|
123
|
+
null,
|
|
124
|
+
executor,
|
|
125
|
+
new CredentialManagerCallback<
|
|
126
|
+
GetCredentialResponse,
|
|
127
|
+
GetCredentialException
|
|
128
|
+
>() {
|
|
129
|
+
@Override
|
|
130
|
+
public void onResult(GetCredentialResponse result) {
|
|
131
|
+
handleSignInResult(result, call);
|
|
132
|
+
}
|
|
148
133
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
.addCredentialOption(googleIdOptionFiltered)
|
|
153
|
-
.build();
|
|
154
|
-
|
|
155
|
-
Executor executor = Executors.newSingleThreadExecutor();
|
|
156
|
-
credentialManager.getCredentialAsync(
|
|
157
|
-
context,
|
|
158
|
-
filteredRequest,
|
|
159
|
-
null,
|
|
160
|
-
executor,
|
|
161
|
-
new CredentialManagerCallback<
|
|
162
|
-
GetCredentialResponse,
|
|
163
|
-
GetCredentialException
|
|
164
|
-
>() {
|
|
165
|
-
@Override
|
|
166
|
-
public void onResult(GetCredentialResponse result) {
|
|
167
|
-
handleSignInResult(result, call);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
@Override
|
|
171
|
-
public void onError(GetCredentialException e) {
|
|
172
|
-
handleSignInError(e, call);
|
|
173
|
-
}
|
|
134
|
+
@Override
|
|
135
|
+
public void onError(GetCredentialException e) {
|
|
136
|
+
handleSignInError(e, call);
|
|
174
137
|
}
|
|
175
|
-
|
|
176
|
-
|
|
138
|
+
}
|
|
139
|
+
);
|
|
177
140
|
}
|
|
178
141
|
|
|
179
142
|
private void persistState(String idToken) throws JSONException {
|
package/dist/docs.json
CHANGED
|
@@ -518,26 +518,6 @@
|
|
|
518
518
|
"docs": "Set if your application needs to refresh access tokens when the user is not present at the browser.\nIn response use `serverAuthCode` key",
|
|
519
519
|
"complexTypes": [],
|
|
520
520
|
"type": "boolean | undefined"
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
"name": "newUI",
|
|
524
|
-
"tags": [
|
|
525
|
-
{
|
|
526
|
-
"text": "use new UI for Google login",
|
|
527
|
-
"name": "description"
|
|
528
|
-
},
|
|
529
|
-
{
|
|
530
|
-
"text": "false",
|
|
531
|
-
"name": "default"
|
|
532
|
-
},
|
|
533
|
-
{
|
|
534
|
-
"text": "0.1.0",
|
|
535
|
-
"name": "since"
|
|
536
|
-
}
|
|
537
|
-
],
|
|
538
|
-
"docs": "New UI",
|
|
539
|
-
"complexTypes": [],
|
|
540
|
-
"type": "boolean | undefined"
|
|
541
521
|
}
|
|
542
522
|
]
|
|
543
523
|
},
|
|
@@ -82,13 +82,6 @@ export interface GoogleLoginOptions {
|
|
|
82
82
|
* @since 0.0.69
|
|
83
83
|
* */
|
|
84
84
|
grantOfflineAccess?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* New UI
|
|
87
|
-
* @description use new UI for Google login
|
|
88
|
-
* @default false
|
|
89
|
-
* @since 0.1.0
|
|
90
|
-
*/
|
|
91
|
-
newUI?: boolean;
|
|
92
85
|
}
|
|
93
86
|
export interface GoogleLoginResponse {
|
|
94
87
|
accessToken: AccessToken | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface InitializeOptions {\n facebook?: {\n /**\n * Facebook App ID, provided by Facebook for web, in mobile it's set in the native files\n */\n appId: string;\n /**\n * Facebook Client Token, provided by Facebook for web, in mobile it's set in the native files\n */\n clientToken: string;\n };\n\n google?: {\n /**\n * The app's client ID, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSClientId?: string;\n /**\n * The app's server client ID, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSServerClientId?: string;\n /**\n * The app's web client ID, found and created in the Google Developers Console.\n * For Android (and web in the future).\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n webClientId?: string;\n };\n apple?: {\n /**\n * Apple Client ID, provided by Apple for web and Android\n */\n clientId?: string;\n /**\n * Apple Redirect URL, should be your backend url that is configured in your apple app, only for android\n */\n redirectUrl?: string;\n };\n}\n\nexport interface FacebookLoginOptions {\n /**\n * Permissions\n * @description select permissions to login with\n */\n permissions: string[];\n /**\n * Is Limited Login\n * @description use limited login for Facebook IOS\n * @default false\n */\n limitedLogin?: boolean;\n /**\n * Nonce\n * @description A custom nonce to use for the login request\n */\n nonce?: string;\n}\n\nexport interface GoogleLoginOptions {\n /**\n * Specifies the scopes required for accessing Google APIs\n * The default is defined in the configuration.\n * @example [\"profile\", \"email\"]\n * @see [Google OAuth2 Scopes](https://developers.google.com/identity/protocols/oauth2/scopes)\n */\n scopes?: string[];\n /**\n * Nonce\n * @description nonce\n */\n nonce?: string;\n /**\n * Set if your application needs to refresh access tokens when the user is not present at the browser.\n * In response use `serverAuthCode` key\n *\n * @default false\n * @since 0.0.69\n * */\n grantOfflineAccess?: boolean;\n
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface InitializeOptions {\n facebook?: {\n /**\n * Facebook App ID, provided by Facebook for web, in mobile it's set in the native files\n */\n appId: string;\n /**\n * Facebook Client Token, provided by Facebook for web, in mobile it's set in the native files\n */\n clientToken: string;\n };\n\n google?: {\n /**\n * The app's client ID, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSClientId?: string;\n /**\n * The app's server client ID, found and created in the Google Developers Console.\n * For iOS.\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n iOSServerClientId?: string;\n /**\n * The app's web client ID, found and created in the Google Developers Console.\n * For Android (and web in the future).\n * @example xxxxxx-xxxxxxxxxxxxxxxxxx.apps.googleusercontent.com\n * @since 3.1.0\n */\n webClientId?: string;\n };\n apple?: {\n /**\n * Apple Client ID, provided by Apple for web and Android\n */\n clientId?: string;\n /**\n * Apple Redirect URL, should be your backend url that is configured in your apple app, only for android\n */\n redirectUrl?: string;\n };\n}\n\nexport interface FacebookLoginOptions {\n /**\n * Permissions\n * @description select permissions to login with\n */\n permissions: string[];\n /**\n * Is Limited Login\n * @description use limited login for Facebook IOS\n * @default false\n */\n limitedLogin?: boolean;\n /**\n * Nonce\n * @description A custom nonce to use for the login request\n */\n nonce?: string;\n}\n\nexport interface GoogleLoginOptions {\n /**\n * Specifies the scopes required for accessing Google APIs\n * The default is defined in the configuration.\n * @example [\"profile\", \"email\"]\n * @see [Google OAuth2 Scopes](https://developers.google.com/identity/protocols/oauth2/scopes)\n */\n scopes?: string[];\n /**\n * Nonce\n * @description nonce\n */\n nonce?: string;\n /**\n * Set if your application needs to refresh access tokens when the user is not present at the browser.\n * In response use `serverAuthCode` key\n *\n * @default false\n * @since 0.0.69\n * */\n grantOfflineAccess?: boolean;\n}\n\nexport interface GoogleLoginResponse {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n email: string | null;\n familyName: string | null;\n givenName: string | null;\n id: string | null;\n name: string | null;\n imageUrl: string | null;\n };\n}\n\nexport interface AppleProviderOptions {\n /**\n * Scopes\n * @description An array of scopes to request during login\n * @example [\"name\", \"email\"]\n * default: [\"name\", \"email\"]\n */\n scopes?: string[];\n /**\n * Nonce\n * @description nonce\n */\n nonce?: string;\n /**\n * State\n * @description state\n */\n state?: string;\n}\n\nexport interface AppleProviderResponse {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n user: string;\n email: string | null;\n givenName: string | null;\n familyName: string | null;\n };\n}\n\nexport interface LoginOptions {\n /**\n * Provider\n * @description select provider to login with\n */\n provider: \"facebook\" | \"google\" | \"apple\" | \"twitter\";\n /**\n * Options\n * @description payload to login with\n */\n options: FacebookLoginOptions | GoogleLoginOptions | AppleProviderOptions;\n}\n\nexport interface LoginResult {\n /**\n * Provider\n * @description select provider to login with\n */\n provider: \"facebook\" | \"google\" | \"apple\" | \"twitter\";\n /**\n * Payload\n * @description payload to login with\n */\n result: FacebookLoginResponse | GoogleLoginResponse | AppleProviderResponse;\n}\n\nexport interface AccessToken {\n applicationId?: string;\n declinedPermissions?: string[];\n expires?: string;\n isExpired?: boolean;\n lastRefresh?: string;\n permissions?: string[];\n token: string;\n refreshToken?: string;\n userId?: string;\n}\n\nexport interface FacebookLoginResponse {\n accessToken: AccessToken | null;\n idToken: string | null;\n profile: {\n userID: string;\n email: string | null;\n friendIDs: string[];\n birthday: string | null;\n ageRange: { min?: number; max?: number } | null;\n gender: string | null;\n location: { id: string; name: string } | null;\n hometown: { id: string; name: string } | null;\n profileURL: string | null;\n name: string | null;\n imageURL: string | null;\n };\n}\n\nexport interface AuthorizationCode {\n /**\n * Jwt\n * @description A JSON web token\n */\n jwt: string;\n}\n\nexport interface AuthorizationCodeOptions {\n /**\n * Provider\n * @description Provider for the authorization code\n */\n provider: \"apple\" | \"google\" | \"facebook\";\n}\n\nexport interface isLoggedInOptions {\n /**\n * Provider\n * @description Provider for the isLoggedIn\n */\n provider: \"apple\" | \"google\" | \"facebook\";\n}\n\nexport interface SocialLoginPlugin {\n /**\n * Initialize the plugin\n * @description initialize the plugin with the required options\n */\n initialize(options: InitializeOptions): Promise<void>;\n /**\n * Login with the selected provider\n * @description login with the selected provider\n */\n login(options: LoginOptions): Promise<LoginResult>;\n /**\n * Logout\n * @description logout the user\n */\n logout(options: { provider: \"apple\" | \"google\" | \"facebook\" }): Promise<void>;\n /**\n * IsLoggedIn\n * @description logout the user\n */\n isLoggedIn(options: isLoggedInOptions): Promise<{ isLoggedIn: boolean }>;\n\n /**\n * Get the current access token\n * @description get the current access token\n */\n getAuthorizationCode(\n options: AuthorizationCodeOptions,\n ): Promise<AuthorizationCode>;\n /**\n * Refresh the access token\n * @description refresh the access token\n */\n refresh(options: LoginOptions): Promise<void>;\n}\n"]}
|