-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ios-aswebauthenticationsession): add plugin (#3421)
* feat(ios-aswebauthenticationsession): add plugin * Update index.ts * returning string instead of any Co-authored-by: Daniel Sogl <daniel@sogls.de>
- Loading branch information
1 parent
79c3284
commit 742ff65
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
src/@ionic-native/plugins/ios-aswebauthenticationsession-api/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; | ||
|
||
/** | ||
* @name ios-aswebauthenticationsession-api | ||
* @description | ||
* Plugin for iOS 12 ASWebAuthenticationSession API | ||
* | ||
* @usage | ||
* ```typescript | ||
* import { IosASWebauthenticationSession } from '@ionic-native/ios-aswebauthenticationsession-api/ngx'; | ||
* | ||
* | ||
* constructor(private IosASWebauthenticationSession: ios-aswebauthenticationsession-api) { } | ||
* | ||
* ... | ||
* | ||
* | ||
* this.IosASWebauthenticationSession.start(callbackUrl, authorizeURL) | ||
* .then((redirectUrl: string) => console.log(redirectUrl)) | ||
* .catch((error: any) => console.error(error)); | ||
* | ||
* ``` | ||
*/ | ||
|
||
@Plugin({ | ||
pluginName: 'IosASWebauthenticationSession', | ||
plugin: 'cordova-plugin-ios-aswebauthenticationsession-api', | ||
pluginRef: 'plugins.ASWebAuthSession', | ||
repo: | ||
'https://github.com/jwelker110/cordova-plugin-ios-aswebauthenticationsession-api', | ||
platforms: ['iOS'], | ||
}) | ||
@Injectable() | ||
export class IosASWebauthenticationSession extends IonicNativePlugin { | ||
/** | ||
* This function start an authentication flow in ASWebauthenticationSession | ||
* @param callbackUrl {string} Callback URL of your App | ||
* @param authorizeURL {number} Authorization URL | ||
* @return {Promise<string>} Returns a promise that resolves a string containing the redirect URL after finishing ASWebauthenticationSession | ||
*/ | ||
@Cordova() | ||
start( | ||
callbackUrl: string, | ||
authorizeURL: string | ||
): Promise<string> { | ||
return; | ||
} | ||
} |