1.0.7 • Published 3 months ago

@emcecosystem/auth-client v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
3 months ago

@emcecosystem/auth-client

INSTALL

npm install --save @emcecosystem/auth-client

Example

import { instance as authClient } from "@emcecosystem/auth-client";
import type { SignInOptions, Message } from "@emcecosystem/auth-client";

type SignInSuccessMessage =
  | Message
  | {
      type: string;
      data: {
        _result: number;
        _desc: string;
        _sid?: string;
        user?: SignInUser;
      };
    };

type SignInUser = {
  id: number;
  nickname: string;
  avatar: string;
};

function onPressSignIn() {
  const options: SignInOptions = {
    provider: "https://emchub.ai/",
    windowOpenerFeatures: "popup,width=480,height=720",
    onSuccess: (message: SignInSuccessMessage) => {
      console.info(message.data);
    },
    onError: (error: string) => {
      console.info(error);
    },
  };
  authClient.signIn(options);
}
1.0.7

3 months ago

1.0.6

3 months ago

1.0.5

3 months ago

1.0.4

3 months ago

1.0.3

3 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago