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.
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)
}
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: { ... }
// }
}
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'
// }
// }
}
Exported functions are extensively documented, and more documentation can be found on our official documentation.
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.