diff --git a/index.d.ts b/index.d.ts index 2baf838..e804e94 100644 --- a/index.d.ts +++ b/index.d.ts @@ -19,13 +19,6 @@ export type User = { picture: string | null; }; -export type State = { - user: User; - isLoading: boolean; - isAuthenticated: boolean; - error?: string | undefined; -}; - export type KindePermissions = { permissions: string[]; orgCode: string; @@ -55,3 +48,24 @@ export type KindeOrganization = { export type KindeOrganizations = { orgCodes: string[]; }; + +export type State = { + user: User; + isLoading: boolean; + isAuthenticated: boolean; + error?: string | undefined; + getToken: () => string | undefined; + getClaim: (claim: string, tokenKey?: string) => any; + getFlag: ( + code: string, + defaultValue?: string | boolean | number, + flagType?: KindeFlagTypeCode + ) => KindeFlag; + getBooleanFlag: (code: string, defaultValue?: boolean) => boolean; + getStringFlag: (code, defaultValue) => string; + getIntegerFlag: (code, defaultValue) => integer; + getPermissions: () => KindePermissions; + getPermission: (key: string) => KindePermission; + getOrganization: () => KindeOrganization; + getUserOrganizations: () => KindeOrganizations; +}; diff --git a/package.json b/package.json index 5a3a5b5..e4342b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kinde-oss/kinde-auth-nextjs", - "version": "1.7.0", + "version": "1.8.0", "description": "Kinde Auth SDK for NextJS", "main": "dist/index.js", "types": "index.d.ts", diff --git a/src/frontend/AuthProvider.jsx b/src/frontend/AuthProvider.jsx index 4d1f742..1db41f8 100644 --- a/src/frontend/AuthProvider.jsx +++ b/src/frontend/AuthProvider.jsx @@ -186,7 +186,7 @@ export const KindeProvider = ({ children }) => { }; const getToken = () => { - return tokens.access_token; + return tokens.access_token_encoded; }; setState((previous) => ({ diff --git a/src/handlers/setup.js b/src/handlers/setup.js index 5c64950..d91340a 100644 --- a/src/handlers/setup.js +++ b/src/handlers/setup.js @@ -10,6 +10,7 @@ export const setup = async (req, res) => { const accessTokenPayload = jwt_decode(token.access_token); const idTokenPayload = jwt_decode(token.id_token); res.send({ + access_token_encoded: token.access_token, id_token: idTokenPayload, access_token: accessTokenPayload, }); diff --git a/src/utils/version.js b/src/utils/version.js index 938c848..3a8bafd 100644 --- a/src/utils/version.js +++ b/src/utils/version.js @@ -1,2 +1,2 @@ // Generated by genversion. -export const version = '1.7.0' +export const version = '1.8.0'