cordova-plugin-oauth 2.0.2 → 3.0.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.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <!--
2
- Copyright 2019 Ayogo Health Inc.
2
+ Copyright 2021 Ayogo Health Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -34,14 +34,23 @@ Installation
34
34
  ------------
35
35
 
36
36
  ```
37
- cordova plugin add cordova-plugin-oauth
37
+ cordova plugin add cordova-plugin-oauth [--variable URL_SCHEME=mycoolapp]
38
38
  ```
39
39
 
40
+ By default, the plugin registers the app ID as a scheme to be used as the
41
+ OAuth callback URL, and expects a host of `oauth_callback` (i.e., if your
42
+ app's ID is `com.example.foo`, your OAuth redirect URL should be
43
+ `com.example.foo://oauth_callback`).
44
+
45
+ The scheme for the OAuth callback URL can be changed by providing a
46
+ `URL_SCHEME` variable when installing. If your `URL_SCHEME` is `mycoolapp`,
47
+ then your OAuth redirect URL should be `mycoolapp://oauth_callback`.
48
+
40
49
 
41
50
  Supported Platforms
42
51
  -------------------
43
52
 
44
- * **iOS** (cordova-ios >= 5.0.0)
53
+ * **iOS** (cordova-ios >= 6.1.0)
45
54
  * **Android** (cordova-android >= 8.0.0)
46
55
 
47
56
 
@@ -56,11 +65,6 @@ Usage
56
65
  window.open(endpoint, 'oauth:google', '');
57
66
  ```
58
67
 
59
- By default, the plugin registers the app ID as a scheme to be used as the
60
- OAuth callback URL, and expects a host of `oauth_callback` (i.e., if your
61
- app's ID is `com.example.foo`, your OAuth redirect URL should be
62
- `com.example.foo://oauth_callback`).
63
-
64
68
  2. The plugin will open the OAuth login page in a new browser window.
65
69
 
66
70
  3. When the OAuth process is complete and it redirects to your app scheme, the
@@ -103,6 +107,6 @@ Licence
103
107
  -------
104
108
 
105
109
  Released under the Apache 2.0 Licence.
106
- Copyright © 2019 Ayogo Health Inc.
110
+ Copyright © 2020 Ayogo Health Inc.
107
111
 
108
112
  [coc]: https://github.com/AyogoHealth/cordova-plugin-oauth/blob/master/CODE_OF_CONDUCT.md
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "cordova-plugin-oauth",
3
- "version": "2.0.2",
3
+ "version": "3.0.2",
4
4
  "author": "Ayogo Health Inc. <info@ayogo.com>",
5
5
  "contributors": [
6
6
  "Darryl Pogue <darryl@dpogue.ca>",
7
+ "Charalampos Pournaris <charpour@gmail.com>",
7
8
  "Harel Mazor"
8
9
  ],
9
10
  "description": "Cordova plugin for performing OAuth login flows.",
@@ -31,7 +32,7 @@
31
32
  },
32
33
  {
33
34
  "name": "cordova-ios",
34
- "version": ">= 5.0.0"
35
+ "version": ">= 6.1.0"
35
36
  }
36
37
  ],
37
38
  "dependencies": {}
package/plugin.xml CHANGED
@@ -14,7 +14,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
  See the License for the specific language governing permissions and
15
15
  limitations under the License.
16
16
  -->
17
- <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-oauth" version="2.0.2">
17
+ <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-oauth" version="3.0.2">
18
18
  <name>cordova-plugin-oauth</name>
19
19
  <description>Cordova plugin for performing OAuth login flows.</description>
20
20
  <keywords>cordova,ios,android,oauth</keywords>
@@ -22,8 +22,10 @@ limitations under the License.
22
22
  <repo>https://github.com/AyogoHealth/cordova-plugin-oauth.git</repo>
23
23
  <issues>https://github.com/AyogoHealth/cordova-plugin-oauth/issues</issues>
24
24
 
25
+ <preference name="URL_SCHEME" default="$PACKAGE_NAME" />
26
+
25
27
  <engines>
26
- <engine name="cordova-ios" version=">= 5.0.0" />
28
+ <engine name="cordova-ios" version=">= 6.1.0" />
27
29
  <engine name="cordova-android" version=">= 8.0.0" />
28
30
  </engines>
29
31
 
@@ -31,6 +33,9 @@ limitations under the License.
31
33
  <clobbers target="open" />
32
34
  </js-module>
33
35
 
36
+ <config-file target="config.xml" parent="/*">
37
+ <preference name="OAuthScheme" value="$URL_SCHEME"/>
38
+ </config-file>
34
39
 
35
40
  <platform name="ios">
36
41
  <config-file parent="/*" target="config.xml">
@@ -47,7 +52,7 @@ limitations under the License.
47
52
  <dict>
48
53
  <key>CFBundleURLSchemes</key>
49
54
  <array>
50
- <string>$PACKAGE_NAME</string>
55
+ <string>$URL_SCHEME</string>
51
56
  </array>
52
57
  </dict>
53
58
  </array>
@@ -71,7 +76,7 @@ limitations under the License.
71
76
  <category android:name="android.intent.category.DEFAULT" />
72
77
  <category android:name="android.intent.category.BROWSABLE" />
73
78
 
74
- <data android:scheme="$PACKAGE_NAME" android:host="oauth_callback" />
79
+ <data android:scheme="$URL_SCHEME" android:host="oauth_callback" />
75
80
  </intent-filter>
76
81
  </config-file>
77
82
 
@@ -124,11 +124,11 @@ class OAuthPlugin : CDVPlugin, SFSafariViewControllerDelegate, ASWebAuthenticati
124
124
  var logger : OSLog?
125
125
 
126
126
  override func pluginInitialize() {
127
- let appID = Bundle.main.bundleIdentifier!
127
+ let urlScheme = self.commandDelegate.settings["oauthscheme"] as! String
128
128
 
129
- self.callbackScheme = "\(appID)://oauth_callback"
129
+ self.callbackScheme = "\(urlScheme)://oauth_callback"
130
130
  if #available(iOS 10.0, *) {
131
- self.logger = OSLog(subsystem: appID, category: "Cordova")
131
+ self.logger = OSLog(subsystem: urlScheme, category: "Cordova")
132
132
  }
133
133
 
134
134
  NotificationCenter.default.addObserver(self,