@capgo/capacitor-social-login 0.0.10
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/CapgoCapacitorSocialLogin.podspec +21 -0
- package/Package.swift +37 -0
- package/README.md +457 -0
- package/android/build.gradle +64 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/ee/forgr/capacitor/social/login/AppleProvider.java +376 -0
- package/android/src/main/java/ee/forgr/capacitor/social/login/FacebookProvider.java +175 -0
- package/android/src/main/java/ee/forgr/capacitor/social/login/GoogleProvider.java +305 -0
- package/android/src/main/java/ee/forgr/capacitor/social/login/SocialLoginPlugin.java +161 -0
- package/android/src/main/java/ee/forgr/capacitor/social/login/helpers/JsonHelper.java +18 -0
- package/android/src/main/java/ee/forgr/capacitor/social/login/helpers/SocialProvider.java +13 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/android/src/main/res/layout/bridge_layout_main.xml +15 -0
- package/android/src/main/res/layout/dialog_custom_layout.xml +43 -0
- package/android/src/main/res/values/styles.xml +14 -0
- package/dist/docs.json +613 -0
- package/dist/esm/definitions.d.ts +191 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +17 -0
- package/dist/esm/web.js +29 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +43 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +46 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/SocialLoginPlugin/AppleProvider.swift +516 -0
- package/ios/Sources/SocialLoginPlugin/FacebookProvider.swift +108 -0
- package/ios/Sources/SocialLoginPlugin/GoogleProvider.swift +165 -0
- package/ios/Sources/SocialLoginPlugin/SocialLoginPlugin.swift +322 -0
- package/ios/Tests/SocialLoginPluginTests/SocialLoginPluginTests.swift +15 -0
- package/package.json +87 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'CapgoCapacitorSocialLogin'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.homepage = package['repository']['url']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
+
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
+
s.ios.deployment_target = '13.0'
|
|
15
|
+
s.dependency 'Capacitor'
|
|
16
|
+
s.dependency 'FBSDKCoreKit', '17.1.0'
|
|
17
|
+
s.dependency 'FBSDKLoginKit', '17.1.0'
|
|
18
|
+
s.dependency 'GoogleSignIn', '~> 8.0.0'
|
|
19
|
+
s.dependency 'Alamofire'
|
|
20
|
+
s.swift_version = '5.1'
|
|
21
|
+
end
|
package/Package.swift
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "CapgoCapacitorSocialLogin",
|
|
6
|
+
platforms: [.iOS(.v13)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "CapgoCapacitorSocialLogin",
|
|
10
|
+
targets: ["SocialLoginPlugin"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "main"),
|
|
14
|
+
// FBSDKCoreKit and FBSDKLoginKit
|
|
15
|
+
.package(url: "https://github.com/facebook/facebook-ios-sdk.git", .upToNextMajor(from: "17.1.0")),
|
|
16
|
+
// Add Google Sign-In dependency
|
|
17
|
+
.package(url: "https://github.com/google/GoogleSignIn-iOS.git", .upToNextMajor(from: "8.0.0")),
|
|
18
|
+
// Alamofire
|
|
19
|
+
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.9.1"))
|
|
20
|
+
],
|
|
21
|
+
targets: [
|
|
22
|
+
.target(
|
|
23
|
+
name: "SocialLoginPlugin",
|
|
24
|
+
dependencies: [
|
|
25
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
26
|
+
.product(name: "Cordova", package: "capacitor-swift-pm"),
|
|
27
|
+
.product(name: "FacebookLogin", package: "facebook-ios-sdk"),
|
|
28
|
+
.product(name: "GoogleSignIn", package: "GoogleSignIn-iOS"),
|
|
29
|
+
.product(name: "Alamofire", package: "Alamofire")
|
|
30
|
+
],
|
|
31
|
+
path: "ios/Sources/SocialLoginPlugin"),
|
|
32
|
+
.testTarget(
|
|
33
|
+
name: "SocialLoginPluginTests",
|
|
34
|
+
dependencies: ["SocialLoginPlugin"],
|
|
35
|
+
path: "ios/Tests/SocialLoginPluginTests")
|
|
36
|
+
]
|
|
37
|
+
)
|
package/README.md
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
# @capgo/capacitor-social-login
|
|
2
|
+
|
|
3
|
+
All social logins in one plugin
|
|
4
|
+
|
|
5
|
+
WIP: Code is ready we ar now polishing documentation
|
|
6
|
+
|
|
7
|
+
This plugin implement social auth for:
|
|
8
|
+
- Google (with credential manager)
|
|
9
|
+
- Apple (with 0auth on android)
|
|
10
|
+
- Facebook ( with latest SDK)
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @capgo/capacitor-social-login
|
|
16
|
+
npx cap sync
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Apple
|
|
20
|
+
|
|
21
|
+
### Android configuration
|
|
22
|
+
|
|
23
|
+
For android you need a server to get the callback from the apple login. As we use the web SDK .
|
|
24
|
+
|
|
25
|
+
Call the `initialize` method with the `apple` provider
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
await SocialLogin.initialize({
|
|
29
|
+
apple: {
|
|
30
|
+
clientId: 'your-client-id',
|
|
31
|
+
redirectUrl: 'your-redirect-url',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
const res = await SocialLogin.login({
|
|
35
|
+
provider: 'apple',
|
|
36
|
+
options: {
|
|
37
|
+
scopes: ['email', 'profile'],
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### iOS configuration
|
|
43
|
+
|
|
44
|
+
call the `initialize` method with the `apple` provider
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
await SocialLogin.initialize({
|
|
48
|
+
apple: {
|
|
49
|
+
clientId: 'your-client-id',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
const res = await SocialLogin.login({
|
|
53
|
+
provider: 'apple',
|
|
54
|
+
options: {
|
|
55
|
+
scopes: ['email', 'profile'],
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Facebook
|
|
61
|
+
|
|
62
|
+
### Android configuration
|
|
63
|
+
|
|
64
|
+
In file `android/app/src/main/AndroidManifest.xml`, add the following XML elements under `<manifest><application>` :
|
|
65
|
+
|
|
66
|
+
```xml
|
|
67
|
+
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
|
|
68
|
+
<meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
In file `android/app/src/main/res/values/strings.xml` add the following lines :
|
|
72
|
+
|
|
73
|
+
```xml
|
|
74
|
+
<string name="facebook_app_id">[APP_ID]</string>
|
|
75
|
+
<string name="facebook_client_token">[CLIENT_TOKEN]</string>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Don't forget to replace `[APP_ID]` and `[CLIENT_TOKEN]` by your Facebook application Id.
|
|
79
|
+
|
|
80
|
+
More information can be found here: https://developers.facebook.com/docs/android/getting-started
|
|
81
|
+
|
|
82
|
+
Then call the `initialize` method with the `facebook` provider
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
await SocialLogin.initialize({
|
|
86
|
+
facebook: {
|
|
87
|
+
appId: 'your-app-id',
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
const res = await SocialLogin.login({
|
|
91
|
+
provider: 'facebook',
|
|
92
|
+
options: {
|
|
93
|
+
permissions: ['email', 'public_profile'],
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### iOS configuration
|
|
99
|
+
|
|
100
|
+
In file `ios/App/App/AppDelegate.swift` add or replace the following:
|
|
101
|
+
|
|
102
|
+
```swift
|
|
103
|
+
import UIKit
|
|
104
|
+
import Capacitor
|
|
105
|
+
import FBSDKCoreKit
|
|
106
|
+
|
|
107
|
+
@UIApplicationMain
|
|
108
|
+
class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
109
|
+
|
|
110
|
+
var window: UIWindow?
|
|
111
|
+
|
|
112
|
+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
|
113
|
+
// Override point for customization after application launch.
|
|
114
|
+
FBSDKCoreKit.ApplicationDelegate.shared.application(
|
|
115
|
+
application,
|
|
116
|
+
didFinishLaunchingWithOptions: launchOptions
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
return true
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
...
|
|
123
|
+
|
|
124
|
+
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
|
|
125
|
+
// Called when the app was launched with a url. Feel free to add additional processing here,
|
|
126
|
+
// but if you want the App API to support tracking app url opens, make sure to keep this call
|
|
127
|
+
if (FBSDKCoreKit.ApplicationDelegate.shared.application(
|
|
128
|
+
app,
|
|
129
|
+
open: url,
|
|
130
|
+
sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
|
|
131
|
+
annotation: options[UIApplication.OpenURLOptionsKey.annotation]
|
|
132
|
+
)) {
|
|
133
|
+
return true;
|
|
134
|
+
} else {
|
|
135
|
+
return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Add the following in the `ios/App/App/info.plist` file inside of the outermost `<dict>`:
|
|
143
|
+
|
|
144
|
+
```xml
|
|
145
|
+
|
|
146
|
+
<key>CFBundleURLTypes</key>
|
|
147
|
+
<array>
|
|
148
|
+
<dict>
|
|
149
|
+
<key>CFBundleURLSchemes</key>
|
|
150
|
+
<array>
|
|
151
|
+
<string>fb[APP_ID]</string>
|
|
152
|
+
</array>
|
|
153
|
+
</dict>
|
|
154
|
+
</array>
|
|
155
|
+
<key>FacebookAppID</key>
|
|
156
|
+
<string>[APP_ID]</string>
|
|
157
|
+
<key>FacebookClientToken</key>
|
|
158
|
+
<string>[CLIENT_TOKEN]</string>
|
|
159
|
+
<key>FacebookDisplayName</key>
|
|
160
|
+
<string>[APP_NAME]</string>
|
|
161
|
+
<key>LSApplicationQueriesSchemes</key>
|
|
162
|
+
<array>
|
|
163
|
+
<string>fbapi</string>
|
|
164
|
+
<string>fbauth</string>
|
|
165
|
+
<string>fb-messenger-share-api</string>
|
|
166
|
+
<string>fbauth2</string>
|
|
167
|
+
<string>fbshareextension</string>
|
|
168
|
+
</array>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
More information can be found here: https://developers.facebook.com/docs/facebook-login/ios
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
Then call the `initialize` method with the `facebook` provider
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
await SocialLogin.initialize({
|
|
178
|
+
facebook: {
|
|
179
|
+
appId: 'your-app-id',
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
const res = await SocialLogin.login({
|
|
183
|
+
provider: 'facebook',
|
|
184
|
+
options: {
|
|
185
|
+
permissions: ['email', 'public_profile'],
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Google
|
|
191
|
+
|
|
192
|
+
### Android configuration
|
|
193
|
+
|
|
194
|
+
Directly call the `initialize` method with the `google` provider
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
await SocialLogin.initialize({
|
|
198
|
+
google: {
|
|
199
|
+
clientId: 'your-client-id', // the web client id
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
const res = await SocialLogin.login({
|
|
203
|
+
provider: 'google',
|
|
204
|
+
options: {
|
|
205
|
+
scopes: ['email', 'profile'],
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### iOS configuration
|
|
211
|
+
|
|
212
|
+
Call the `initialize` method with the `google` provider
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
await SocialLogin.initialize({
|
|
216
|
+
google: {
|
|
217
|
+
clientId: 'your-client-id', // the web client id
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
const res = await SocialLogin.login({
|
|
221
|
+
provider: 'google',
|
|
222
|
+
options: {
|
|
223
|
+
scopes: ['email', 'profile'],
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## API
|
|
229
|
+
|
|
230
|
+
<docgen-index>
|
|
231
|
+
|
|
232
|
+
* [`initialize(...)`](#initialize)
|
|
233
|
+
* [`login(...)`](#login)
|
|
234
|
+
* [`logout(...)`](#logout)
|
|
235
|
+
* [`isLoggedIn(...)`](#isloggedin)
|
|
236
|
+
* [`getAuthorizationCode(...)`](#getauthorizationcode)
|
|
237
|
+
* [`refresh(...)`](#refresh)
|
|
238
|
+
* [Interfaces](#interfaces)
|
|
239
|
+
|
|
240
|
+
</docgen-index>
|
|
241
|
+
|
|
242
|
+
<docgen-api>
|
|
243
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
244
|
+
|
|
245
|
+
### initialize(...)
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
initialize(options: InitializeOptions) => Promise<void>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Initialize the plugin
|
|
252
|
+
|
|
253
|
+
| Param | Type |
|
|
254
|
+
| ------------- | --------------------------------------------------------------- |
|
|
255
|
+
| **`options`** | <code><a href="#initializeoptions">InitializeOptions</a></code> |
|
|
256
|
+
|
|
257
|
+
--------------------
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
### login(...)
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
login(options: LoginOptions) => Promise<LoginResult>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Login with the selected provider
|
|
267
|
+
|
|
268
|
+
| Param | Type |
|
|
269
|
+
| ------------- | ----------------------------------------------------- |
|
|
270
|
+
| **`options`** | <code><a href="#loginoptions">LoginOptions</a></code> |
|
|
271
|
+
|
|
272
|
+
**Returns:** <code>Promise<<a href="#loginresult">LoginResult</a>></code>
|
|
273
|
+
|
|
274
|
+
--------------------
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
### logout(...)
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
logout(options: { provider: "apple" | "google" | "facebook"; }) => Promise<void>
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Logout
|
|
284
|
+
|
|
285
|
+
| Param | Type |
|
|
286
|
+
| ------------- | ------------------------------------------------------------- |
|
|
287
|
+
| **`options`** | <code>{ provider: 'facebook' \| 'google' \| 'apple'; }</code> |
|
|
288
|
+
|
|
289
|
+
--------------------
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
### isLoggedIn(...)
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
isLoggedIn(options: isLoggedInOptions) => Promise<{ isLoggedIn: boolean; }>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
IsLoggedIn
|
|
299
|
+
|
|
300
|
+
| Param | Type |
|
|
301
|
+
| ------------- | --------------------------------------------------------------- |
|
|
302
|
+
| **`options`** | <code><a href="#isloggedinoptions">isLoggedInOptions</a></code> |
|
|
303
|
+
|
|
304
|
+
**Returns:** <code>Promise<{ isLoggedIn: boolean; }></code>
|
|
305
|
+
|
|
306
|
+
--------------------
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
### getAuthorizationCode(...)
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
getAuthorizationCode(options: AuthorizationCodeOptions) => Promise<AuthorizationCode>
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Get the current access token
|
|
316
|
+
|
|
317
|
+
| Param | Type |
|
|
318
|
+
| ------------- | ----------------------------------------------------------------------------- |
|
|
319
|
+
| **`options`** | <code><a href="#authorizationcodeoptions">AuthorizationCodeOptions</a></code> |
|
|
320
|
+
|
|
321
|
+
**Returns:** <code>Promise<<a href="#authorizationcode">AuthorizationCode</a>></code>
|
|
322
|
+
|
|
323
|
+
--------------------
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
### refresh(...)
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
refresh(options: LoginOptions) => Promise<void>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Refresh the access token
|
|
333
|
+
|
|
334
|
+
| Param | Type |
|
|
335
|
+
| ------------- | ----------------------------------------------------- |
|
|
336
|
+
| **`options`** | <code><a href="#loginoptions">LoginOptions</a></code> |
|
|
337
|
+
|
|
338
|
+
--------------------
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
### Interfaces
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
#### InitializeOptions
|
|
345
|
+
|
|
346
|
+
| Prop | Type |
|
|
347
|
+
| -------------- | ------------------------------------------------------- |
|
|
348
|
+
| **`facebook`** | <code>{ appId: string; }</code> |
|
|
349
|
+
| **`google`** | <code>{ clientId: string; }</code> |
|
|
350
|
+
| **`apple`** | <code>{ clientId: string; redirectUrl: string; }</code> |
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
#### LoginResult
|
|
354
|
+
|
|
355
|
+
| Prop | Type | Description |
|
|
356
|
+
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
|
|
357
|
+
| **`provider`** | <code>'facebook' \| 'google' \| 'apple' \| 'twitter'</code> | Provider |
|
|
358
|
+
| **`result`** | <code><a href="#facebookloginresponse">FacebookLoginResponse</a> \| <a href="#googleloginresponse">GoogleLoginResponse</a> \| <a href="#appleproviderresponse">AppleProviderResponse</a></code> | Payload |
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
#### FacebookLoginResponse
|
|
362
|
+
|
|
363
|
+
| Prop | Type |
|
|
364
|
+
| ----------------- | ----------------------------------------------------------- |
|
|
365
|
+
| **`accessToken`** | <code><a href="#accesstoken">AccessToken</a> \| null</code> |
|
|
366
|
+
| **`profile`** | <code>{ fields: readonly string[]; }</code> |
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
#### AccessToken
|
|
370
|
+
|
|
371
|
+
| Prop | Type |
|
|
372
|
+
| ------------------------- | --------------------- |
|
|
373
|
+
| **`applicationId`** | <code>string</code> |
|
|
374
|
+
| **`declinedPermissions`** | <code>string[]</code> |
|
|
375
|
+
| **`expires`** | <code>string</code> |
|
|
376
|
+
| **`isExpired`** | <code>boolean</code> |
|
|
377
|
+
| **`lastRefresh`** | <code>string</code> |
|
|
378
|
+
| **`permissions`** | <code>string[]</code> |
|
|
379
|
+
| **`token`** | <code>string</code> |
|
|
380
|
+
| **`userId`** | <code>string</code> |
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
#### GoogleLoginResponse
|
|
384
|
+
|
|
385
|
+
| Prop | Type |
|
|
386
|
+
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
387
|
+
| **`accessToken`** | <code><a href="#accesstoken">AccessToken</a> \| null</code> |
|
|
388
|
+
| **`idToken`** | <code>string \| null</code> |
|
|
389
|
+
| **`profile`** | <code>{ email: string \| null; familyName: string \| null; givenName: string \| null; id: string \| null; name: string \| null; imageUrl: string \| null; }</code> |
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
#### AppleProviderResponse
|
|
393
|
+
|
|
394
|
+
| Prop | Type |
|
|
395
|
+
| ----------------------- | --------------------------- |
|
|
396
|
+
| **`user`** | <code>string \| null</code> |
|
|
397
|
+
| **`email`** | <code>string \| null</code> |
|
|
398
|
+
| **`givenName`** | <code>string \| null</code> |
|
|
399
|
+
| **`familyName`** | <code>string \| null</code> |
|
|
400
|
+
| **`identityToken`** | <code>string \| null</code> |
|
|
401
|
+
| **`authorizationCode`** | <code>string</code> |
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
#### LoginOptions
|
|
405
|
+
|
|
406
|
+
| Prop | Type | Description |
|
|
407
|
+
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
|
|
408
|
+
| **`provider`** | <code>'facebook' \| 'google' \| 'apple' \| 'twitter'</code> | Provider |
|
|
409
|
+
| **`options`** | <code><a href="#facebookloginoptions">FacebookLoginOptions</a> \| <a href="#googleloginoptions">GoogleLoginOptions</a> \| <a href="#appleprovideroptions">AppleProviderOptions</a></code> | Options |
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
#### FacebookLoginOptions
|
|
413
|
+
|
|
414
|
+
| Prop | Type | Description |
|
|
415
|
+
| ----------------- | --------------------- | ----------- |
|
|
416
|
+
| **`permissions`** | <code>string[]</code> | Permissions |
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
#### GoogleLoginOptions
|
|
420
|
+
|
|
421
|
+
| Prop | Type | Description | Default | Since |
|
|
422
|
+
| ------------------------ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ----- |
|
|
423
|
+
| **`scopes`** | <code>string[]</code> | Specifies the scopes required for accessing Google APIs The default is defined in the configuration. | | |
|
|
424
|
+
| **`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> | 3.1.0 |
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
#### AppleProviderOptions
|
|
428
|
+
|
|
429
|
+
| Prop | Type | Description |
|
|
430
|
+
| ----------------- | --------------------- | ------------ |
|
|
431
|
+
| **`scopes`** | <code>string[]</code> | Scopes |
|
|
432
|
+
| **`redirectURI`** | <code>string</code> | Redirect URI |
|
|
433
|
+
| **`nonce`** | <code>string</code> | Nonce |
|
|
434
|
+
| **`state`** | <code>string</code> | State |
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
#### isLoggedInOptions
|
|
438
|
+
|
|
439
|
+
| Prop | Type | Description |
|
|
440
|
+
| -------------- | ---------------------------------------------- | ----------- |
|
|
441
|
+
| **`provider`** | <code>'facebook' \| 'google' \| 'apple'</code> | Provider |
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
#### AuthorizationCode
|
|
445
|
+
|
|
446
|
+
| Prop | Type | Description |
|
|
447
|
+
| --------- | ------------------- | ----------- |
|
|
448
|
+
| **`jwt`** | <code>string</code> | Jwt |
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
#### AuthorizationCodeOptions
|
|
452
|
+
|
|
453
|
+
| Prop | Type | Description |
|
|
454
|
+
| -------------- | ---------------------------------------------- | ----------- |
|
|
455
|
+
| **`provider`** | <code>'facebook' \| 'google' \| 'apple'</code> | Provider |
|
|
456
|
+
|
|
457
|
+
</docgen-api>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
buildscript {
|
|
9
|
+
repositories {
|
|
10
|
+
google()
|
|
11
|
+
mavenCentral()
|
|
12
|
+
}
|
|
13
|
+
dependencies {
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.2.1'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
apply plugin: 'com.android.library'
|
|
19
|
+
|
|
20
|
+
android {
|
|
21
|
+
namespace "ee.forgr.capacitor.social.login"
|
|
22
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
|
+
}
|
|
30
|
+
buildTypes {
|
|
31
|
+
release {
|
|
32
|
+
minifyEnabled false
|
|
33
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
lintOptions {
|
|
37
|
+
abortOnError false
|
|
38
|
+
}
|
|
39
|
+
compileOptions {
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
repositories {
|
|
46
|
+
google()
|
|
47
|
+
mavenCentral()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
dependencies {
|
|
52
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
53
|
+
implementation project(':capacitor-android')
|
|
54
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
55
|
+
implementation 'com.facebook.android:facebook-login:17.0.0'
|
|
56
|
+
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
|
|
57
|
+
implementation 'com.auth0.android:jwtdecode:2.0.2'
|
|
58
|
+
implementation "androidx.credentials:credentials:1.2.2"
|
|
59
|
+
implementation "androidx.credentials:credentials-play-services-auth:1.2.2"
|
|
60
|
+
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
|
|
61
|
+
testImplementation "junit:junit:$junitVersion"
|
|
62
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
63
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
64
|
+
}
|