Skip to content

Commit

Permalink
Merge pull request #22 from kinde-oss/dave/add-missing-token-types
Browse files Browse the repository at this point in the history
Add missing token types
  • Loading branch information
evgenyk authored May 3, 2023
2 parents 75315ad + efdbdf8 commit 358117b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
28 changes: 21 additions & 7 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/AuthProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export const KindeProvider = ({ children }) => {
};

const getToken = () => {
return tokens.access_token;
return tokens.access_token_encoded;
};

setState((previous) => ({
Expand Down
1 change: 1 addition & 0 deletions src/handlers/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
2 changes: 1 addition & 1 deletion src/utils/version.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 358117b

Please sign in to comment.