2.4.0 • Published 1 year ago

@kobbleio/admin v2.4.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Manage your Kobble project and users from your server with Kobble Admin SDK

License Status Deno Node Supabase

Getting started

Initialize a Kobble instance from a secret generated from your Kobble dashboard.

import { Kobble } from '@kobbleio/admin'

const main = async () => {
    const kobble = new Kobble('YOUR_SECRET');
    const whoami = await kobble.whoami();

    // To verify your setup
    console.log(whoami);
}

main();

Verify User Tokens

Verify ID Token

You can verify ID tokens obtained using Kobble frontend SDKs as follows:

import { Kobble } from '@kobbleio/admin'

const main = async () => {
    const kobble = new Kobble('YOUR_SECRET');
    const result = await kobble.auth.verifyIdToken('ID_TOKEN');
    
    console.log(result)
    // Output:
    // {
    //     userId: 'clu9ob5480001mdhwk9qt00hv',
    //     user: {
    //         id: 'clu9ob5480001mdhwk9qt00hv',
    //         email: 'kevinpiac@gmail.com',
    //         name: null,
    //         pictureUrl: null,
    //         isVerified: true,
    //         stripeId: null,
    //         updatedAt: 2024-03-27T10:39:02.000Z,
    //         createdAt: 2024-03-27T10:39:02.000Z
    //     },
    //     claims: { ... }
    // }
}

Verify Access Token

You can verify access tokens obtained using Kobble frontend SDKs as follows:

import { Kobble } from '@kobbleio/admin'

const main = async () => {
    const kobble = new Kobble('YOUR_SECRET');
    
    const result = await kobble.auth.verifyAccessToken('ACCESS_TOKEN');
    
    console.log(result)
    // Output:
    // {
    //     projectId: 'cltxiphfv000129anb0kuagow',
    //     userId: 'clu9ob5480001mdhwk9qt00hv',
    //     claims: {
    //         sub: 'clu9ob5480001mdhwk9qt00hv',
    //         project_id: 'cltxiphfv000129anb0kuagow',
    //         iat: 1713183109,
    //         exp: 1713186709689,
    //         iss: 'https://kobble.io',
    //         aud: 'clu9ntcvr0000o9yfz87ybo4a'
    //     }
    // }
}

The main difference between the two tokens is that the ID token contains user information, while the access token contains project and User ID only.

Documentation

Exported functions are extensively documented, and more documentation can be found on our official docs.


What is Kobble?

2.3.0

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.4.0

1 year ago

2.2.2

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.4.6

1 year ago

1.4.5

1 year ago

1.4.8

1 year ago

1.4.7

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.2.3

1 year ago

1.2.1

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago