From e39ea60f53fe869ac582973fc61cd424c318c2e2 Mon Sep 17 00:00:00 2001 From: pfvatterott Date: Wed, 26 Mar 2025 15:28:29 -0600 Subject: [PATCH 1/2] Update README.md --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e24b004..8fecc7c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- +

@@ -17,6 +17,60 @@ Your frontend gets a beautiful, safe, and customizable login screen. Your backen - Full reference this library is [here](https://docs.propelauth.com/reference/frontend-apis/js) - Getting started guides for PropelAuth are [here](https://docs.propelauth.com/) +## Installation and Usage + +```bash +npm install @propelauth/javascript +``` + +and then you can import it: + +```js +import { createClient } from "@propelauth/javascript"; +``` + +Alternatively, you can use a CDN: + +```html + +``` + +then a global PropelAuth object will be created, and you can call createClient from it: + +```html + +``` + +## Using the Javascript library + +You'll create a client using the [createClient](#create-client) function, and then you can use the client to get information about the current user. + +You can also enabled background token refresh, which will automatically refresh the user's information periodically and on key events (e.g. user switches tabs, reconnects to the internet, etc). + + +### createClient + +Creates an authentication client which manages your user's [access token](https://docs.propelauth.com/guides-and-examples/guides/access-tokens), fetches user information, and provides other useful authentication functions. + +The client also refreshes auth information when a user switches focus to your tab or reconnects (if they were offline). + +```js +const authClient = createClient({ + // The base URL where your authentication pages are hosted. + // You can find this under the Frontend Integration section for your project. + authUrl: "https://auth.yourdomain.com", + + // If true, periodically refresh the access token in the background. + // This helps ensure you always have a valid token ready to go. Default true. + enableBackgroundTokenRefresh: true, +}); +``` + ## Questions? Feel free to reach out at support@propelauth.com From 4bd3e6dbe94146ed40cfd668dbb51edb7d38d1cf Mon Sep 17 00:00:00 2001 From: pfvatterott Date: Thu, 27 Mar 2025 13:21:03 -0600 Subject: [PATCH 2/2] Update CDN URL --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8fecc7c..d0a56eb 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,10 @@ import { createClient } from "@propelauth/javascript"; Alternatively, you can use a CDN: ```html - + ``` then a global PropelAuth object will be created, and you can call createClient from it: