0.6.8 • Published 6 months ago

@userfront/core v0.6.8

Weekly downloads
28
License
-
Repository
github
Last release
6 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: increment patch version & build all library files
  • npm build:beta: increment prerelease version & 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
  • npm build:ie11: build the IE11-compatible library file: userfront-core.ie11.umd.js
    • This script applies a patch to microbundle to enable Babel transformation of dependencies, so that Promises from axios are polyfilled without needing to touch the global Promise object.
0.6.5-beta.1

10 months ago

0.6.7

7 months ago

0.6.6

9 months ago

0.6.8

6 months ago

0.6.3

11 months ago

0.6.2

11 months ago

0.6.5

10 months ago

0.6.4

10 months ago

0.6.1-beta.0

11 months ago

0.6.1

11 months ago

0.6.0

12 months ago

0.5.6

1 year ago

0.5.5

1 year ago

0.5.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.5.8

1 year ago

0.5.7

1 year ago

0.5.0-alpha.1

1 year ago

0.5.0-alpha.0

1 year ago

0.4.7

1 year ago

0.4.3-beta.0

2 years ago

0.4.6-beta.0

2 years ago

0.4.4-beta.3

2 years ago

0.4.4-beta.0

2 years ago

0.4.6

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.4.4

2 years ago

0.4.1

2 years ago

0.4.3

2 years ago

0.3.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.2.42

2 years ago

0.2.41

2 years ago

0.2.40

2 years ago

0.2.39

2 years ago

0.2.38

2 years ago

0.2.37

2 years ago

0.2.36

2 years ago

0.2.35

2 years ago

0.2.30

3 years ago

0.2.33

3 years ago

0.2.32

3 years ago

0.2.31

3 years ago

0.2.28

3 years ago

0.2.26

3 years ago

0.2.24

3 years ago

0.2.23

3 years ago

0.2.22

3 years ago

0.2.19

3 years ago

0.2.18

3 years ago

0.2.17

3 years ago

0.2.16

3 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.9

3 years ago

0.1.22-beta.3

3 years ago

0.1.22-beta.2

3 years ago

0.1.21

3 years ago

0.2.1

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.8

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.1.20

3 years ago

0.1.18

3 years ago

0.1.19

3 years ago

0.1.17

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.14

3 years ago

0.1.13

3 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.9

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.0

4 years ago