Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ constructor(private _tokenService: Angular2TokenService) {
oAuthCallbackPath: 'oauth_callback',
oAuthWindowType: 'newWindow',
oAuthWindowOptions: null,
oAuthBrowserCallback: null,

userTypes: null,

Expand Down Expand Up @@ -178,8 +179,9 @@ constructor(private _tokenService: Angular2TokenService) {
| `oAuthBase?: string` | Configure the OAuth server (used for backends on a different url) |
| `oAuthPaths?: { [key:string]: string }` | Sets paths for sign in with OAuth |
| `oAuthCallbackPath?: string` | Sets path for OAuth sameWindow callback |
| `oAuthWindowType?:`string` | Window type for Oauth authentication |
| `oAuthWindowType?: string` | Window type for Oauth authentication |
| `oAuthWindowOptions?: { [key:string]: string }` | Set additional options to pass into `window.open()` |
| `oAuthBrowserCallback?: string` | Full url for the callback at the end of your server-side auth flow. e.g. `https://<YOUR API HERE>/auth/facebook/callback#_=_` |
### Global Options
| Options | Description |
| ------------------------------------- | ----------------------------------------------- |
Expand Down Expand Up @@ -297,8 +299,13 @@ this._tokenService.resetPassword({
```

### .signInOAuth()
Initiates OAuth authentication flow. Currently, it supports two window modes:
`newWindow` (default) and `sameWindow` (settable in config as `oAuthWindowType`).
Initiates OAuth authentication flow. Currently, it supports three window modes:
`inAppBrowser` (default, for android and ios), `newWindow` (for desktop flow, falls back to this when running ionic
serve) and `sameWindow` (settable in config as `oAuthWindowType`).

- When `oAuthWindowType` is set to `inAppBrowser`, `.signInOAuth()` opens a new window and completes the login flow.
Will return an observable in future.

- When `oAuthWindowType` is set to `newWindow`, `.signInOAuth()` opens a new window and returns an observable.

- When `oAuthWindowType` is set to `sameWindow`, `.signInOAuth()` returns nothing and redirects user to auth provider.
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
"webpack": "3.8.1",
"zone.js": "0.8.18"
},
"dependencies": {
"@ionic-native/core": "^4.2.1",
"@ionic-native/in-app-browser": "^4.2.1",
"ionic-angular": "^3.6.1"
},
"author": "Jan-Philipp Riethmacher <[email protected]>",
"license": "MIT",
"repository": {
Expand Down
1 change: 1 addition & 0 deletions src/angular2-token.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export interface Angular2TokenOptions {
oAuthCallbackPath?: string;
oAuthWindowType?: string;
oAuthWindowOptions?: { [key:string]: string; };
oAuthBrowserCallback?: string;

globalOptions?: GlobalOptions;
}
Loading