0.1.1 • Published 7 months ago

capacitor-simple-social-auth4app v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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; }>
ParamType
options{ social: SocialAuthEnum; }

Returns: Promise<{ key: string; success: boolean; }>


addListener('authSuccess', ...)

addListener(eventName: 'authSuccess', listenerFunc: (event: AuthEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
ParamType
eventName'authSuccess'
listenerFunc(event: AuthEvent) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


addListener('authError', ...)

addListener(eventName: 'authError', listenerFunc: (event: AuthEvent) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
ParamType
eventName'authError'
listenerFunc(event: AuthEvent) => void

Returns: Promise<PluginListenerHandle> & PluginListenerHandle


removeAllListeners()

removeAllListeners() => Promise<void>

Interfaces

PluginListenerHandle

PropType
remove() => Promise<void>

AuthEvent

PropType
keystring
userInfoany

Enums

SocialAuthEnum

MembersValue
VK'vk'
OK'ok'
GOOGLE'google'
YANDEX'yandex'
MAILRU'mailru'