diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index eb2217b5..94677dfb 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,12 +1,12 @@ # Contributing -I'm happy to accept external contributions to the project in the form of feedback, +I'm happy to accept external contributions to the project in the form of feedback, bug reports and even better - pull requests ## Issues -Issues are mostly used to track **bugs** and **feature requests** but you can also +Issues are mostly used to track **bugs** and **feature requests** but you can also ask questions as it's the only place I'm looking at. Before reporting a bug or requesting a feature, run a few searches to @@ -28,7 +28,7 @@ a duplicate. ## Pull Request Guidelines * Please check to make sure that there aren't existing pull requests attempting to address the issue mentioned. * Open a single PR for each subject. -* Develop in a topic branch, not master (feature-name). +* Develop in a topic branch, not main (feature-name). * Write a convincing description of your PR and why I should land it. * Update documentation comments where applicable. diff --git a/CHANGELOG.md b/CHANGELOG.md index 5683ce8f..3e593bb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,18 @@ * Added `logoutUrl` to base options [#97](https://github.com/moberwasserlechner/capacitor-oauth2/issues/97) ### Fixed -* iOS: Fix boolean param inheritance (#111) [#111](https://github.com/moberwasserlechner/capacitor-oauth2/issues/111) +* iOS: Fix boolean param inheritance [#111](https://github.com/moberwasserlechner/capacitor-oauth2/issues/111) + +## [3.0.1] - 2021-08-10 + +### Docs +* Add securely save tokens to docs [#139](https://github.com/moberwasserlechner/capacitor-oauth2/issues/139) Thank you [@RaphaelWoude](https://github.com/RaphaelWoude) + +### Changed +* Chore: Use main instead of master branch [#168](https://github.com/moberwasserlechner/capacitor-oauth2/issues/168) + +### Fixed +* Android: Use json for responses instead of string [#171](https://github.com/moberwasserlechner/capacitor-oauth2/issues/171) Thank you [@webflo](https://github.com/webflo) ## [3.0.0] - 2021-08-02 @@ -110,8 +121,9 @@ This is controlled by Android specific parameters `handleResultOnNewIntent` for - Android: Fix Java compiler error #36 (thx @Anthbs) - Fix github security error by updating Jest lib -[Unreleased]: https://github.com/moberwasserlechner/capacitor-oauth2/compare/3.0.0...master +[Unreleased]: https://github.com/moberwasserlechner/capacitor-oauth2/compare/3.0.1...main [3.1.0]: https://github.com/moberwasserlechner/capacitor-oauth2/compare/3.0.0...3.1.0 +[3.0.1]: https://github.com/moberwasserlechner/capacitor-oauth2/compare/3.0.0...3.0.1 [3.0.0]: https://github.com/moberwasserlechner/capacitor-oauth2/compare/2.1.0...3.0.0 [2.1.0]: https://github.com/moberwasserlechner/capacitor-oauth2/compare/2.0.0...2.1.0 [2.0.0]: https://github.com/moberwasserlechner/capacitor-oauth2/compare/1.1.0...2.0.0 diff --git a/README.md b/README.md index 75cf5ae2..5db4b322 100644 --- a/README.md +++ b/README.md @@ -5,35 +5,39 @@ -This a generic OAuth 2 client plugin. - -It let you configure the oauth parameters yourself instead of using SDKs. Therefore it is usable with various providers. +This is a **generic OAuth 2 client** plugin. It let you configure the oauth parameters yourself instead of using SDKs. Therefore it is usable with various providers. See [providers](#list-of-providers) the community has already used this plugin with. -## Maintainers - -| Maintainer | GitHub | Social | -| -----------| -------| -------| -| Michael Oberwasserlechner | [moberwasserlechner](https://github.com/moberwasserlechner) | [@michaelowl_web](https://twitter.com/michaelowl_web) | - -Actively maintained: YES - -## Install +## How to install +For Capacitor v3 ```bash npm i @byteowls/capacitor-oauth2 npx cap sync ``` +For Capacitor v2 use `2.1.0` +```bash +npm i @byteowls/capacitor-oauth2@2.1.0 +npx cap sync +``` ## Versions -| Plugin | Capacitor | Docs | Notes | +| Plugin | For Capacitor | Docs | Notes | |--------|-------------------|----------------------------------------------------------------------------------------|--------------------------------| -| 3.x | 3.x.x | [README](https://github.com/moberwasserlechner/capacitor-oauth2/blob/master/README.md) | Breaking changes see Changelog. XCode 12.0 needs this version | +| 3.x | 3.x.x | [README](https://github.com/moberwasserlechner/capacitor-oauth2/blob/main/README.md) | Breaking changes see Changelog. XCode 12.0 needs this version | | 2.x | 2.x.x | [README](https://github.com/moberwasserlechner/capacitor-oauth2/blob/2.1.0/README.md) | Breaking changes see Changelog. XCode 11.4 needs this version | | 1.x | 1.x.x | [README](https://github.com/moberwasserlechner/capacitor-oauth2/blob/1.1.0/README.md) | | -For further details on what has changed see the [CHANGELOG](https://github.com/moberwasserlechner/capacitor-oauth2/blob/master/CHANGELOG.md). +For further details on what has changed see the [CHANGELOG](https://github.com/moberwasserlechner/capacitor-oauth2/blob/main/CHANGELOG.md). + +## Maintainers + +| Maintainer | GitHub | Social | +| -----------| -------| -------| +| Michael Oberwasserlechner | [moberwasserlechner](https://github.com/moberwasserlechner) | [@michaelowl_web](https://twitter.com/michaelowl_web) | + +Actively maintained: YES ## Supported flows @@ -151,7 +155,7 @@ export class SignupComponent { ### Options -See the `oauth2Options` and `oauth2RefreshOptions` interfaces at https://github.com/moberwasserlechner/capacitor-oauth2/blob/master/src/definitions.ts for details. +See the `oauth2Options` and `oauth2RefreshOptions` interfaces at https://github.com/moberwasserlechner/capacitor-oauth2/blob/main/src/definitions.ts for details. Example: ``` @@ -160,6 +164,7 @@ Example: accessTokenEndpoint: "https://www.googleapis.com/oauth2/v4/token", scope: "email profile", resourceUrl: "https://www.googleapis.com/userinfo/v2/me", + logsEnabled: true, web: { appId: environment.oauthAppId.google.web, responseType: "token", // implicit flow @@ -382,12 +387,12 @@ Open `ios/App/App/Info.plist` in XCode (Context menu -> Open as -> Source) and a ### Custom OAuth Handler -Some OAuth provider (e.g. Facebook) force developers to use their SDK on iOS. +Some OAuth provider (e.g., Facebook) force developers to use their SDK on iOS. -This plugin should be as generic as possible so I don't want to include provider specific dependencies. +This plugin should be as generic as possible, so I don't want to include provider specific dependencies. -Therefore I created a mechanism which let developers integrate custom SDK features in this plugin. -Simply configure a the class name in the option property `ios.customHandlerClass`. +Therefore, I created a mechanism which let developers integrate custom SDK features in this plugin. +Simply configure the class name in the option property `ios.customHandlerClass`. This class has to implement `ByteowlsCapacitorOauth2.OAuth2CustomHandler`. See a full working example below! @@ -397,6 +402,16 @@ See a full working example below! - No timeline. + +## Where to store access tokens? + +You can use the [capacitor-secure-storage](https://www.npmjs.com/package/capacitor-secure-storage-plugin) plugin for this. + +This plugin stores data in secure locations for natives devices. +- For Android, it will store data in a [`AndroidKeyStore`](https://developer.android.com/training/articles/keystore) and a [`SharedPreferences`](https://developer.android.com/reference/android/content/SharedPreferences). +- For iOS, it will store data in a [`SwiftKeychainWrapper`](https://github.com/jrendel/SwiftKeychainWrapper). + + ## List of Providers These are some of the providers that can be configured with this plugin. I'm happy to add others ot the list, if you let me know. @@ -429,8 +444,8 @@ The plugin requires `authorizationBaseUrl` as it triggers the native support and `appId` is required as well for internal, generic reasons and any not blank value is fine. -It is also possible to control the scope although Apple only supports `email` and/or `fullName`. Add `siwaUseScope: true` to the ios block -and then you can use `scope: "fullName"`, `scope: "email"` or both but the latter is the default one if `siwaUseScope` is not set or false. +It is also possible to control the scope although Apple only supports `email` and/or `fullName`. Add `siwaUseScope: true` to the ios section. +Then you can use `scope: "fullName"`, `scope: "email"` or both but the latter is the default one if `siwaUseScope` is not set or false. ```typescript appleLogin() { @@ -1038,14 +1053,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ## Contribute -See [Contribution Guidelines](https://github.com/moberwasserlechner/capacitor-oauth2/blob/master/.github/CONTRIBUTING.md). +See [Contribution Guidelines](https://github.com/moberwasserlechner/capacitor-oauth2/blob/main/.github/CONTRIBUTING.md). ## Changelog -See [CHANGELOG](https://github.com/moberwasserlechner/capacitor-oauth2/blob/master/CHANGELOG.md). +See [CHANGELOG](https://github.com/moberwasserlechner/capacitor-oauth2/blob/main/CHANGELOG.md). ## License -MIT. See [LICENSE](https://github.com/moberwasserlechner/capacitor-oauth2/blob/master/LICENSE). +MIT. See [LICENSE](https://github.com/moberwasserlechner/capacitor-oauth2/blob/main/LICENSE). ## BYTEOWLS Software & Consulting