Skip to content

kobble-io/go-admin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

License Status Go Supabase

Project Status

This project is not currently in stable status. We are actively working on fixing bugs and adding new features. Fill free to open an issue / open PR if you have any questions or need help.

Getting started

Installation

go get github.com/kobble-io/go-admin/kobble

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

import (
    "fmt"
    "log"
    "github.com/kobble-io/go-admin/kobble"
)

func main() {
    k := kobble.New("YOUR_SECRET", kobble.Options{})
    whoami, err := k.Whoami()
    if err != nil {
        log.Fatal(err)
    }

    // To verify your setup
    fmt.Println(whoami)
}

Verify User Tokens

Verify ID Token

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

func main() {
    k := kobble.New("YOUR_SECRET", kobble.Options{})
    result, err := k.Auth.VerifyIdToken("ID_TOKEN")
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(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:

func main() {
	k := kobble.New("YOUR_SECRET", kobble.Options{})
	result, err := k.Auth.VerifyAccessToken("ACCESS_TOKEN")
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(result)
	// Output:
	// {
	//     projectId: 'cltxiphfv000129anb0kuagow',
	//     userId: 'clu9ob5480001mdhwk9qt00hv',
	//     claims: {
	//         sub: 'clu9ob5480001mdhwk9qt00hv',
	//         project_id: 'cltxiphfv000129anb0kuagow',
	//         iat: 1713183109,
	//         exp: 1713186709689,
	//         iss: 'https://kobble.io',
	//         aud: 'clu9ntcvr0000o9yfz87ybo4a'
	//     }
	// }
}

Documentation

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

What is Kobble

Kobble Logo

Kobble is the one-stop solution for monetizing modern SaaS and APIs. It allows to add authentication, analytics and payment to any app in under 10 minutes.

About

Manage your customers with the Kobble Admin SDK

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages