capacitor-simple-social-auth4app
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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(...)

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'

Readme

Keywords

Package Sidebar

Install

npm i capacitor-simple-social-auth4app

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

61.8 kB

Total Files

28

Last publish

Collaborators

  • antonseagull