academe-kit 0.1.1 → 0.1.2

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.
package/dist/index.js CHANGED
@@ -2259,6 +2259,9 @@ const SecurityContext = React.createContext({
2259
2259
  email: "",
2260
2260
  name: "",
2261
2261
  lastName: "",
2262
+ attributes: {
2263
+ school_ids: [],
2264
+ },
2262
2265
  }),
2263
2266
  signOut: () => null,
2264
2267
  goToLogin: () => null,
@@ -2277,10 +2280,14 @@ const SecurityProvider = ({ hubUrl, children, }) => {
2277
2280
  window.accessToken = keycloak.token;
2278
2281
  }, [keycloak.token]);
2279
2282
  const getUser = () => {
2283
+ const idTokenParsed = keycloak?.idTokenParsed || {};
2280
2284
  return {
2281
2285
  email: keycloak?.idTokenParsed?.email || "",
2282
2286
  name: keycloak?.idTokenParsed?.given_name || "",
2283
2287
  lastName: keycloak?.idTokenParsed?.family_name || "",
2288
+ attributes: {
2289
+ school_ids: (idTokenParsed.school_ids || []),
2290
+ },
2284
2291
  };
2285
2292
  };
2286
2293
  const redirectToHub = (errorMessage) => {