You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then a global PropelAuth object will be created, and you can call createClient from it:
42
+
43
+
```html
44
+
<script>
45
+
PropelAuth.createClient({...});
46
+
</script>
47
+
```
48
+
49
+
## Using the Javascript library
50
+
51
+
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.
52
+
53
+
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).
54
+
55
+
56
+
### createClient
57
+
58
+
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.
59
+
60
+
The client also refreshes auth information when a user switches focus to your tab or reconnects (if they were offline).
61
+
62
+
```js
63
+
constauthClient=createClient({
64
+
// The base URL where your authentication pages are hosted.
65
+
// You can find this under the Frontend Integration section for your project.
66
+
authUrl:"https://auth.yourdomain.com",
67
+
68
+
// If true, periodically refresh the access token in the background.
69
+
// This helps ensure you always have a valid token ready to go. Default true.
0 commit comments