Skip to content

Commit

Permalink
token improve
Browse files Browse the repository at this point in the history
  • Loading branch information
trunges21 committed Mar 22, 2023
1 parent 750e8e0 commit 77306bf
Show file tree
Hide file tree
Showing 29 changed files with 443 additions and 219 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
dist
.DS_Store
coverage
coverage
.jest
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist
dist
.jest
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,19 +554,19 @@ _Note: Ensure you have already run `npm install` before_

## KindeSDK methods

| Property | Description | Arguments | Usage | Sample output |
| -------------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| login | Constructs redirect url and sends user to Kinde to sign in | {<br>org_code?: string<br>} | kinde.login(); or<br>kinde.login({org_code: 'your organization code'}) // Allow `org_code` to be provided if a specific org is to be signed up into. | |
| register | Constructs redirect url and sends user to Kinde to sign up | {<br>org_code?: string<br>} | kinde.register(); or<br>kinde.register({org_code: 'your organization code'}) // Allow `org_code` to be provided if a specific org is to be registered into. | |
| logout | Logs the user out of Kinde | | kinde.logout(); | |
| getToken | Returns the raw Access token from URL after logged from Kinde | url: string | kinde.getToken(url); | {<br>"access_token": "eyJhbGciOiJSUzI...",<br>"expires_in": 86400,<br>"id_token": "eyJhbGciOiJSU...",<br>"refresh_token": "yXI1bFQKbXKLD7AIU...",<br>"scope": "openid profile email offline",<br>"token_type": "bearer"<br>} |
| Property | Description | Arguments | Usage | Sample output |
| -------------------- | ------------------------------------------------------------------------------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| login | Constructs redirect url and sends user to Kinde to sign in | {<br>org_code?: string<br>} | kinde.login(); or<br>kinde.login({org_code: 'your organization code'}) // Allow `org_code` to be provided if a specific org is to be signed up into. | |
| register | Constructs redirect url and sends user to Kinde to sign up | {<br>org_code?: string<br>} | kinde.register(); or<br>kinde.register({org_code: 'your organization code'}) // Allow `org_code` to be provided if a specific org is to be registered into. | |
| logout | Logs the user out of Kinde | | kinde.logout(); | |
| getToken | Returns the raw Access token from URL after logged from Kinde | url: string | kinde.getToken(url); | {<br>"access_token": "eyJhbGciOiJSUzI...",<br>"expires_in": 86400,<br>"id_token": "eyJhbGciOiJSU...",<br>"refresh_token": "yXI1bFQKbXKLD7AIU...",<br>"scope": "openid profile email offline",<br>"token_type": "bearer"<br>} |
| createOrg | Constructs redirect url and sends user to Kinde to sign up and create a new org for your business | {<br>org_name?: string<br>} | kinde.createOrg(); or<br>kinde.createOrg({org_name: 'your organization name'}); // Allow `org_name` to be provided if you want a specific organization name when you create | |
| getClaim | Gets a claim from an access or id token | claim: string;<br>tokenKey?: string | kinde.getClaim('given_name', 'id_token'); | "David" |
| getPermission | Returns the state of a given permission | key: string | kinde.getPermission('read:todos'); | {"orgCode":"org_1234","isGranted":true} |
| getPermissions | Returns all permissions for the current user for the organization they are logged into | | kinde.getPermissions(); | {"orgCode":"org_1234","permissions":["create:todos","update:todos","read:todos"]} |
| getOrganization | Get details for the organization your user is logged into | | kinde.getOrganization(); | {"orgCode": "org_1234"} |
| getUserDetails | Returns the profile for the current user | | kinde.getUserDetails(); | {"given_name":"Dave","id":"abcdef","family_name":"Smith","email":"[email protected]"} |
| getUserOrganizations | Gets an array of all organizations the user has access to | | kinde.getUserOrganizations(); | {"orgCodes":["org1​234","org5​678"]} |
| getClaim | Gets a claim from an access or id token | claim: string;<br>tokenKey?: string | kinde.getClaim('given_name', 'id_token'); | "David" |
| getPermission | Returns the state of a given permission | key: string | kinde.getPermission('read:todos'); | {"orgCode":"org_1234","isGranted":true} |
| getPermissions | Returns all permissions for the current user for the organization they are logged into | | kinde.getPermissions(); | {"orgCode":"org_1234","permissions":["create:todos","update:todos","read:todos"]} |
| getOrganization | Get details for the organization your user is logged into | | kinde.getOrganization(); | {"orgCode": "org_1234"} |
| getUserDetails | Returns the profile for the current user | | kinde.getUserDetails(); | {"given_name":"Dave","id":"abcdef","family_name":"Smith","email":"[email protected]"} |
| getUserOrganizations | Gets an array of all organizations the user has access to | | kinde.getUserOrganizations(); | {"orgCodes":["org1​234","org5​678"]} |

## General tips

Expand Down
Loading

0 comments on commit 77306bf

Please sign in to comment.