capacitor-simple-social-auth4app
v0.1.1
Published
SimpleSocialAuth4App is a Capacitor plugin designed to simplify the process of authenticating users through various social networks using the auth4app service. It provides a seamless and secure authentication experience by opening a dedicated WebView for
Downloads
9
Maintainers
Readme
capacitor-simple-social-auth4app
SimpleSocialAuth4App - это плагин Capacitor, разработанный для упрощения процесса аутентификации пользователей через различные социальные сети с использованием сервиса auth4app. Он обеспечивает безпроблемный и безопасный опыт аутентификации, открывая отдельное окно WebView для ввода учетных данных пользователей, обрабатывая обратные вызовы и безопасно возвращая результаты аутентификации в приложение Capacitor.
SimpleSocialAuth4App is a Capacitor plugin designed to simplify the process of authenticating users through various social networks using the auth4app service. It provides a seamless and secure authentication experience by opening a dedicated WebView for user credentials entry, handling callbacks, and securely returning authentication results to the Capacitor application.
import {
SimpleSocialAuth4App,
SocialAuthEnum,
} from "capacitor-simple-social-auth4app";
...
// Удаляем слушатели на всякий случай
// Removing listeners just in case
SimpleSocialAuth4App.removeAllListeners();
// Вызываем окно авторизации
// Trigger the authentication window
SimpleSocialAuth4App.auth({ social: SocialAuthEnum.GOOGLE });
// Получим данные пользователя после успешной авторизации
// Obtain user data after successful authentication
SimpleSocialAuth4App.addListener("authSuccess", (e) => {
console.log(e);
});
// Получим любые ошибки которые были в процессе авторизации
// Obtain any errors that occurred during the authentication process
SimpleSocialAuth4App.addListener("authError", (e) => {
console.log(e);
});
Install
npm install capacitor-simple-social-auth4app
npx cap sync
API
auth(...)
addListener('authSuccess', ...)
addListener('authError', ...)
removeAllListeners()
- Interfaces
- Enums
auth(...)
auth(options: { social: SocialAuthEnum; }) => Promise<{ key: string; success: boolean; }>
| Param | Type |
| ------------- | ---------------------------------------------------------------------- |
| options
| { social: SocialAuthEnum; } |
Returns: Promise<{ key: string; success: boolean; }>
addListener('authSuccess', ...)
addListener(eventName: 'authSuccess', listenerFunc: (event: AuthEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
| Param | Type |
| ------------------ | ------------------------------------------------------------------- |
| eventName
| 'authSuccess' |
| listenerFunc
| (event: AuthEvent) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
addListener('authError', ...)
addListener(eventName: 'authError', listenerFunc: (event: AuthEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
| Param | Type |
| ------------------ | ------------------------------------------------------------------- |
| eventName
| 'authError' |
| listenerFunc
| (event: AuthEvent) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
removeAllListeners()
removeAllListeners() => Promise<void>
Interfaces
PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove
| () => Promise<void> |
AuthEvent
| Prop | Type |
| -------------- | ------------------- |
| key
| string |
| userInfo
| any |
Enums
SocialAuthEnum
| Members | Value |
| ------------ | --------------------- |
| VK
| 'vk' |
| OK
| 'ok' |
| GOOGLE
| 'google' |
| YANDEX
| 'yandex' |
| MAILRU
| 'mailru' |