1.1.1 • Published 10 months ago

@userfront/core v1.1.1

Weekly downloads
28
License
-
Repository
github
Last release
10 months ago

Userfront Core JS library

The Userfront Core JavaScript library is intended for use in frontend applications.

The Core library can be used for the following:

  • Tokens: read the user's access token to send to your backend
  • User info: information about the currently logged in user
  • Authentication: signup, login, logout, and password reset tasks; these are useful for building custom forms and auth flows.

Docs

Full docs can be found in the Userfront guide:

https://userfront.com/docs/js.html

Setup

Install by npm (or yarn):

npm install @userfront/core --save

Import and initialize the library:

import Userfront from "@userfront/core";

Userfront.init("demo1234");

Examples

// Import and initialize Userfront core JS
import Userfront from "@userfront/core";
Userfront.init("demo1234");

// Send a login link
Userfront.sendLoginLink("jane@example.com");

// Read the access token
Userfront.tokens.accessToken;

// => "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJtb2RlIjoidGVzdCIsImlzQ29uZmlybWVkIjp0cnVlLCJ1c2VySWQiOjEsInVzZXJVdWlkIjoiZDAwNTlmN2UtYzU0OS00NmYzLWEzYTMtOGEwNDY0MDkzZmMyIiwidGVuYW50SWQiOiJwOW55OGJkaiIsInNlc3Npb25JZCI6IjRlZjBlMjdjLTI1NDAtNDIzOS05YTJiLWRkZjgyZjE3YmExYiIsImF1dGhvcml6YXRpb24iOnsicDlueThiZGoiOnsidGVuYW50SWQiOiJwOW55OGJkaiIsIm5hbWUiOiJVc2VyZnJvbnQiLCJyb2xlcyI6WyJhZG1pbiJdLCJwZXJtaXNzaW9ucyI6W119fSwiaWF0IjoxNjE3MTQ4MDY3LCJleHAiOjE2MTk3NDAwNjd9.gYz4wxPHLY6PNp8KPEyIjLZ8QzG3-NFJGPitginuLaU"

// Log the user out
Userfront.logout();

// Access the user's information
Userfront.user;

/** =>
 * {
 *    email: "jane@example.com",
 *    phoneNumber: "+15558675309",
 *    name: "Jane Example",
 *    image: "https://res.cloudinary.com/component/image/upload/avatars/avatar-plain-9.png",
 *    data: {},
 *    username: "jane-example",
 *    isEmailConfirmed: true,
 *    isPhoneNumberConfirmed: false,
 *    confirmedEmailAt: "2020-01-01T00:00:00.000Z",
 *    confirmedPhoneNumberAt: "2020-01-01T00:00:00.000Z",
 *    isMfaRequired: false,
 *    createdAt: "2020-01-01T00:00:00.000Z",
 *    updatedAt: "2020-01-01T00:00:00.000Z",
 *    mode: "test",
 *    tenantId: "demo1234",
 *    userId: 1,
 *    userUuid: "d6f0f045-f6ea-4262-8724-dfc0b77e7dc9",
 * }
 */

Development

Building

  • npm build: build all library files

The build commands are split into two parts. build and build:beta both run these commands, which do not need to be run separately:

  • npm build:standard: build the standard library files:
    • ESM module build/userfront-core.module.js
    • CJS module build/userfront-core.js
    • UMD module build/userfront-core.umd.js
    • Module with bundled dependencies, for import from CDN: build/userfront-core.modern.mjs
1.1.1

10 months ago

1.1.0

10 months ago

1.0.1

10 months ago

1.0.0

1 year ago

0.6.5-beta.1

2 years ago

0.6.7

2 years ago

0.6.6

2 years ago

0.6.8

2 years ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.5

2 years ago

0.6.4

2 years ago

0.6.1-beta.0

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.6

2 years ago

0.5.5

2 years ago

0.5.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.5.8

2 years ago

0.5.7

2 years ago

0.5.0-alpha.1

3 years ago

0.5.0-alpha.0

3 years ago

0.4.7

3 years ago

0.4.3-beta.0

3 years ago

0.4.6-beta.0

3 years ago

0.4.4-beta.3

3 years ago

0.4.4-beta.0

3 years ago

0.4.6

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.4.4

3 years ago

0.4.1

3 years ago

0.4.3

3 years ago

0.3.0

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.2.42

3 years ago

0.2.41

4 years ago

0.2.40

4 years ago

0.2.39

4 years ago

0.2.38

4 years ago

0.2.37

4 years ago

0.2.36

4 years ago

0.2.35

4 years ago

0.2.30

4 years ago

0.2.33

4 years ago

0.2.32

4 years ago

0.2.31

4 years ago

0.2.28

4 years ago

0.2.26

4 years ago

0.2.24

4 years ago

0.2.23

4 years ago

0.2.22

4 years ago

0.2.19

4 years ago

0.2.18

4 years ago

0.2.17

4 years ago

0.2.16

4 years ago

0.2.15

4 years ago

0.2.14

4 years ago

0.2.13

4 years ago

0.2.12

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.1.22-beta.3

4 years ago

0.1.22-beta.2

4 years ago

0.1.21

4 years ago

0.2.1

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.8

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.1.20

4 years ago

0.1.18

4 years ago

0.1.19

4 years ago

0.1.17

4 years ago

0.1.15

4 years ago

0.1.16

4 years ago

0.1.14

5 years ago

0.1.13

5 years ago

0.1.12

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.9

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.0

5 years ago