Skip to content

Commit

Permalink
Add 'onAutoRefreshFailure' to vue config
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeLo123 committed May 8, 2024
1 parent 525bfc3 commit b45b804
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 44 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
"build:sdk-vue": "yarn build:lexicon && yarn build:core && yarn workspace @fusionauth/vue-sdk build",
"yalc-pub:sdk-react": "yarn build:sdk-react && yalc publish packages/sdk-react",
"yalc-push:sdk-react": "yarn build:sdk-react && yalc push packages/sdk-react",
"yalc-pub:sdk-vue": "yarn build:sdk-vue && yalc publish packages/sdk-vue",
"yalc-push:sdk-vue": "yarn build:sdk-vue && yalc push packages/sdk-vue",
"test": "yarn test:lexicon && yarn test:core && yarn test:sdk-react && yarn test:sdk-angular && yarn test:sdk-vue",
"test:core": "yarn workspace @fusionauth-sdk/core test",
"test:lexicon": "yarn workspace @fusionauth-sdk/lexicon test",
Expand Down
5 changes: 5 additions & 0 deletions packages/sdk-vue/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
fusionauth-vue-sdk Changes

Changes in 1.0.1

- Adds `onAutoRefreshFailure` option to `FusionAuthConfig`.
- _Bug fix_ `isLoggedIn` property is set to `false` after token refresh. [See issue #82](https://github.com/FusionAuth/fusionauth-javascript-sdk/issues/82)

Changes in 1.0.0

- _Breaking change_ `isLoggedIn` property -- previously a function -- is now using [Vue's Reactivity API](https://vuejs.org/api/reactivity-core.html). The benefit of this is that it can be used as a reactive property in Vue.
Expand Down
9 changes: 9 additions & 0 deletions packages/sdk-vue/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ An SDK for using FusionAuth in Vue applications.
- [Pre-built buttons](#pre-built-buttons)
- [Quickstart](#quickstart)
- [Documentation](#documentation)
- [Known Issues](#known-issues)
- [Releases](#releases)
- [Upgrade Policy](#upgrade-policy)

Expand Down Expand Up @@ -215,6 +216,14 @@ end::forDocSite[]
Use backticks for code in this readme. This readme is included on the FusionAuth website, and backticks show the code in the best light there.
## Known issues
### Nuxt
This issue affects versions `<=1.0.0`.
If you are using [Nuxt](https://nuxt.com/) or any type of SSR (server side rendering), the SDK will not work. [See details here.](https://github.com/FusionAuth/fusionauth-javascript-sdk/issues/74)
## Releases
This package is released via GitHub actions.
Expand Down
26 changes: 13 additions & 13 deletions packages/sdk-vue/docs/interfaces/types.FusionAuth.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Error occurred within getUserInfo.

#### Defined in

[types.ts:113](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L113)
[types.ts:118](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L118)

---

Expand All @@ -52,7 +52,7 @@ Internally updates `isFetchingUser` and `userInfo` refs, as well as `error` if t

#### Defined in

[types.ts:98](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L98)
[types.ts:103](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L103)

---

Expand All @@ -73,7 +73,7 @@ Refresh is scheduled to happen at the configured `autoRefreshSecondsBeforeExpiry

#### Defined in

[types.ts:142](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L142)
[types.ts:147](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L147)

---

Expand All @@ -85,7 +85,7 @@ Indicates that the getUserInfo call is unresolved.

#### Defined in

[types.ts:108](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L108)
[types.ts:113](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L113)

---

Expand All @@ -97,7 +97,7 @@ Whether the user is logged in.

#### Defined in

[types.ts:91](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L91)
[types.ts:96](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L96)

---

Expand All @@ -123,7 +123,7 @@ Initiates login flow.

#### Defined in

[types.ts:119](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L119)
[types.ts:124](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L124)

---

Expand All @@ -143,28 +143,28 @@ Initiates a logout.

#### Defined in

[types.ts:130](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L130)
[types.ts:135](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L135)

---

### refreshToken

**refreshToken**: () => `Promise`\<`void`\>
**refreshToken**: () => `Promise`\<`Response`\>

Refreshes the access token a single time.
Token refreshing is handled automatically if configured with `shouldAutoRefresh`.

#### Type declaration

▸ (): `Promise`\<`void`\>
▸ (): `Promise`\<`Response`\>

##### Returns

`Promise`\<`void`\>
`Promise`\<`Response`\>

#### Defined in

[types.ts:136](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L136)
[types.ts:141](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L141)

---

Expand All @@ -190,7 +190,7 @@ Initiates register flow.

#### Defined in

[types.ts:125](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L125)
[types.ts:130](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L130)

---

Expand All @@ -202,4 +202,4 @@ Data fetched from the configured 'me' endpoint.

#### Defined in

[types.ts:103](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L103)
[types.ts:108](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L108)
53 changes: 40 additions & 13 deletions packages/sdk-vue/docs/interfaces/types.FusionAuthConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Config for the FusionAuth Vue SDK
- [loginPath](types.FusionAuthConfig.md#loginpath)
- [logoutPath](types.FusionAuthConfig.md#logoutpath)
- [mePath](types.FusionAuthConfig.md#mepath)
- [onAutoRefreshFailure](types.FusionAuthConfig.md#onautorefreshfailure)
- [onRedirect](types.FusionAuthConfig.md#onredirect)
- [redirectUri](types.FusionAuthConfig.md#redirecturi)
- [registerPath](types.FusionAuthConfig.md#registerpath)
Expand All @@ -34,7 +35,7 @@ The number of seconds before the access token expiry when the auto refresh funct

#### Defined in

[types.ts:38](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L38)
[types.ts:38](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L38)

---

Expand All @@ -46,7 +47,7 @@ The client id of the application.

#### Defined in

[types.ts:14](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L14)
[types.ts:14](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L14)

---

Expand All @@ -58,7 +59,7 @@ The path to the login endpoint.

#### Defined in

[types.ts:48](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L48)
[types.ts:53](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L53)

---

Expand All @@ -70,7 +71,7 @@ The path to the logout endpoint.

#### Defined in

[types.ts:52](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L52)
[types.ts:57](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L57)

---

Expand All @@ -82,7 +83,33 @@ The path to the me endpoint.

#### Defined in

[types.ts:64](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L64)
[types.ts:69](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L69)

---

### onAutoRefreshFailure

`Optional` **onAutoRefreshFailure**: (`error`: `Error`) => `void`

Callback to be invoked if a request to refresh the access token fails during autorefresh.

#### Type declaration

▸ (`error`): `void`

##### Parameters

| Name | Type |
| :------ | :------ |
| `error` | `Error` |

##### Returns

`void`

#### Defined in

[types.ts:48](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L48)

---

Expand All @@ -108,7 +135,7 @@ Callback function to be invoked with the `state` value upon redirect from login

#### Defined in

[types.ts:43](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L43)
[types.ts:43](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L43)

---

Expand All @@ -120,7 +147,7 @@ The redirect URI of the application.

#### Defined in

[types.ts:18](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L18)
[types.ts:18](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L18)

---

Expand All @@ -132,7 +159,7 @@ The path to the register endpoint.

#### Defined in

[types.ts:56](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L56)
[types.ts:61](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L61)

---

Expand All @@ -144,7 +171,7 @@ The OAuth2 scope parameter passed to the `/oauth2/authorize` endpoint. If not sp

#### Defined in

[types.ts:23](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L23)
[types.ts:23](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L23)

---

Expand All @@ -156,7 +183,7 @@ The URL of the FusionAuth server.

#### Defined in

[types.ts:10](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L10)
[types.ts:10](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L10)

---

Expand All @@ -168,7 +195,7 @@ Enables the SDK to automatically handle fetching user info when logged in. Defau

#### Defined in

[types.ts:33](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L33)
[types.ts:33](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L33)

---

Expand All @@ -180,7 +207,7 @@ Enables automatic token refreshing. Defaults to false.

#### Defined in

[types.ts:28](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L28)
[types.ts:28](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L28)

---

Expand All @@ -192,4 +219,4 @@ The path to the token refresh endpoint.

#### Defined in

[types.ts:60](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L60)
[types.ts:65](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L65)
22 changes: 11 additions & 11 deletions packages/sdk-vue/docs/interfaces/types.UserInfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ User information returned from FusionAuth.

#### Defined in

[types.ts:71](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L71)
[types.ts:76](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L76)

---

Expand All @@ -40,7 +40,7 @@ User information returned from FusionAuth.

#### Defined in

[types.ts:72](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L72)
[types.ts:77](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L77)

---

Expand All @@ -50,7 +50,7 @@ User information returned from FusionAuth.

#### Defined in

[types.ts:73](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L73)
[types.ts:78](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L78)

---

Expand All @@ -60,7 +60,7 @@ User information returned from FusionAuth.

#### Defined in

[types.ts:74](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L74)
[types.ts:79](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L79)

---

Expand All @@ -70,7 +70,7 @@ User information returned from FusionAuth.

#### Defined in

[types.ts:75](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L75)
[types.ts:80](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L80)

---

Expand All @@ -80,7 +80,7 @@ User information returned from FusionAuth.

#### Defined in

[types.ts:81](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L81)
[types.ts:86](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L86)

---

Expand All @@ -90,7 +90,7 @@ User information returned from FusionAuth.

#### Defined in

[types.ts:76](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L76)
[types.ts:81](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L81)

---

Expand All @@ -100,7 +100,7 @@ User information returned from FusionAuth.

#### Defined in

[types.ts:77](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L77)
[types.ts:82](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L82)

---

Expand All @@ -110,7 +110,7 @@ User information returned from FusionAuth.

#### Defined in

[types.ts:78](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L78)
[types.ts:83](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L83)

---

Expand All @@ -120,7 +120,7 @@ User information returned from FusionAuth.

#### Defined in

[types.ts:79](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L79)
[types.ts:84](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L84)

---

Expand All @@ -130,4 +130,4 @@ User information returned from FusionAuth.

#### Defined in

[types.ts:80](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/types.ts#L80)
[types.ts:85](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/types.ts#L85)
2 changes: 1 addition & 1 deletion packages/sdk-vue/docs/modules/composables_useFusionAuth.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@

#### Defined in

[composables/useFusionAuth.ts:5](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/fcd17d440e603901f23776175e07b35fc625e758/packages/sdk-vue/src/composables/useFusionAuth.ts#L5)
[composables/useFusionAuth.ts:5](https://github.com/FusionAuth/fusionauth-javascript-sdk/blob/525bfc3280cf0ce66d562e4b96351ecc387e5857/packages/sdk-vue/src/composables/useFusionAuth.ts#L5)
Loading

0 comments on commit b45b804

Please sign in to comment.