@evoke-platform/context 1.0.0-dev.127 → 1.0.0-dev.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +20 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -17,6 +17,7 @@ available and no further installation is necessary.
17
17
 
18
18
  - [Working With Objects](#working-with-objects)
19
19
  - [REST API Calls](#rest-api-calls)
20
+ - [Authentication Context](#authentication-context)
20
21
  - [Notifications](#notifications)
21
22
 
22
23
  ### Working With Objects
@@ -206,6 +207,25 @@ absolute URL.
206
207
 
207
208
  ##### `delete(url, options)`
208
209
 
210
+ ### Authentication Context
211
+
212
+ - [useAuthenticationContext](#useauthenticationcontext)
213
+
214
+ #### `useAuthenticationContext()`
215
+
216
+ Hook to obtain the authentication context based on the current logged-in user.
217
+
218
+ The authentication context includes the following property and functions.
219
+
220
+ - `account` _[object]_
221
+ - The account of the currently logged-in user. This includes both the user's `id` and `name`.
222
+ - `logout()`
223
+ - A function that logs out the currently logged-in user. The user will be redirected to Evoke's logout page upon logout.
224
+ - `getAccessToken()`
225
+ - A function that returns an access token that is associated to the currently logged-in user. This token can be used to make API calls to Evoke's APIs to authenticate the API call.
226
+ - Note: As a general recommendation, the [ApiService](#class-apiservices) class should be used to make API calls as it will take care
227
+ of appending an access token to the call.
228
+
209
229
  ### Notifications
210
230
 
211
231
  - [useNofitication](#usenotification)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/context",
3
- "version": "1.0.0-dev.127",
3
+ "version": "1.0.0-dev.128",
4
4
  "description": "Utilities that provide context to Evoke platform widgets",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",