A fork of the Capacitor Browser API only for iOS that supports extra features for authorization.
npm install @fellow/auth-browserThe Auth Browser API provides the ability to open an in-app browser and subscribe to browser events.
On iOS, this uses ASWebAuthenticationSession and is compliant with leading OAuth service in-app-browser requirements.
on Android please use @capacitor/browser plugin.
``bash`
npm install @fellow/auth-browser
npx cap sync
`typescript
import { AuthBrowser } from '@fellow/auth-browser';
const LoginWithN = async (n: string) => {
const result = await AuthBrowser.start({
url: n,
scheme: "myapp",
});
alert(JSON.stringify(result));
if (result.success) {
// Handle success, result.url should be defined
} else {
// Handle result.error
}
};
`
* start(...)
* abort()
* Interfaces
* Type Aliases
`typescript`
start(options: OpenOptions) => Promise
iOS only: Open a page with the specified options.
Error on other platforms.
| Param | Type |
| ------------- | --------------------------------------------------- |
| options | OpenOptions |
Returns: Promise<SuccessOrFailureResult>
Since: 1.0.0
--------------------
`typescript`
abort() => Promise
iOS only: Close an open browser window.
Error on other platforms.
Since: 1.0.0
--------------------
#### OpenOptions
Represents the options passed to open.
| Prop | Type | Description | Since |
| ------------ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| url | string | The URL to which the browser is opened. | 1.0.0 |
| scheme | string | The Scheme that the browser should listen to for to redirect back to the app. For example if you want to use the scheme myapp:// you would pass myapp`. | |
#### SuccessOrFailureResult
#### SuccessResult
{ success: true; url: string; }
#### FailureResult
{ success: false; error: string; }