1.0.21 • Published 8 months ago

@fidec/authsdk v1.0.21

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Fidec Authentication SDK

The Fidec Authentication SDK is a framework for websites to integrate login functionality through the Fidec application’s authentication page.

Installation

To install the SDK, use npm:

npm install @fidec/authsdk

Cloud

Go to Fidec Cloud, log in, and generate your key there.

Example Usage

import FidecAuth from "@fidec/authsdk";

// Initialize the FidecAuth instance with your configuration
const auth = new FidecAuth({
  key: "your_key",
  rpc: "your_auth_url",
  app_name: "your_app_name",
});

// Function to handle login and fetch user information
(async () => {
  try {
    // Open QR code login and get the authentication ID
    const result = await auth.openQRCodeLogin();

    // Retrieve user information using the authentication ID
    const user = await auth.getUserInfo(result.authId);

    // Log the user information
    console.log({ user });

    // Example user object structure
    // {
    //   user_account: string,
    //   user_avatar: string,
    //   user_cardId: string,
    //   user_email: string,
    //   user_firstName: string,
    //   user_fullName: string,
    //   user_gender: string,
    //   user_lastName: string,
    //   user_localAddress: string,
    //   user_role: string,
    //   user_telephone: string,
    // }
  } catch (error) {
    console.error("Error during authentication:", error);
  }
})();

Contributing

If you would like to contribute to this project, please feel free to submit a pull request.

License

This project is licensed under the MIT License.

This format ensures each code section is properly closed and clearly separated. Let me know if this is what you were aiming for!

1.0.19

8 months ago

1.0.18

8 months ago

1.0.17

8 months ago

1.0.16

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.11

8 months ago

1.0.21

8 months ago

1.0.10

8 months ago

1.0.20

8 months ago

1.0.15

8 months ago

1.0.14

8 months ago

1.0.13

8 months ago

1.0.12

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago