Skip to content

Commit

Permalink
chore: added identity and identityType to token payload (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulkr authored Oct 8, 2024
1 parent 01f1c18 commit 417812b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ require "vendor/autoload.php";
use IntegrationOS\AuthKitToken\AuthKitToken;

$authKitToken = new AuthKitToken("sk_live_12345");
$token = $authKitToken->create([
"group" => "org_123", // a meaningful identifier (i.e., organizationId)
"label" => "Acme", // a human-friendly label (i.e., organizationName)
]);
$token = $authKitToken->create();

echo json_encode($token);
```
Expand All @@ -44,10 +41,7 @@ use IntegrationOS\AuthKitToken\AuthKitToken;
Route::get('/authkit-token', function () {
$authKitToken = new AuthKitToken("sk_live_12345");

$token = $authKitToken->create([
"group" => "org_123", // a meaningful identifier (i.e., organizationId)
"label" => "Acme", // a human-friendly label (i.e., organizationName)
]);
$token = $authKitToken->create();

return $token;
});
Expand All @@ -56,10 +50,8 @@ Route::get('/authkit-token', function () {
You'll want to switch out the API Key for your own, which will later tell your frontend which integrations you'd like to
make available to your users.

You'll also want to populate the `group` and `label` fields depending on how you want to organize and query your users'
connected accounts. The Group is especially important as it's used to generate the
unique [Connection Key](https://docs.integrationos.com/docs/setup) for the user once they successfully connect an
account.
If you pass an `identity` or `identityType` (`user`, `team`, or `organization`), you'll be able to query for all connections scoped to that identity.
The identity is used to generate the unique [Connection Key](https://docs.integrationos.com/docs/setup) for the user once they successfully connect an account.

## Full Documentation

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "integrationos/authkit-php",
"version": "1.2.1",
"version": "1.3.0",
"type": "library",
"autoload": {
"psr-4": {
Expand Down
2 changes: 2 additions & 0 deletions src/AuthKitToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ private function createEmbedToken($connected_platforms, $event_links, $settings)
],
"group" => $event_links["group"],
"label" => $event_links["label"],
"identity" => $event_links["identity"],
"identityType" => $event_links["identityType"],
"environment" => str_starts_with($this->secret, "sk_test") ? "test" : "live",
"expiresAt" => (time() * 1000) + (5 * 1000 * 60),
"sessionId" => $this->getSessionId()['id'],
Expand Down

0 comments on commit 417812b

Please sign in to comment.