Giter VIP home page Giter VIP logo

sdk-go's Introduction

Topicus KeyHub SDK for Go

PkgGoDev

Note: The version number of the SDK must match the version of your Topicus KeyHub installation. An older version of the SDK might work on a newer version of Topicus KeyHub via the provided backwards compatibility layer, but a newer version of the SDK will not work on an older version of Topicus KeyHub.

Note: The GO SDK is current considered in alpha status. Its API might change in future versions, it is largely untested and at the moment only supports the client credentials grant.

1. Installation

go get github.com/topicuskeyhub/sdk-go

2. Getting started

2.1 Create a client application in Topicus KeyHub

Register a OAuth 2.0 client application in Topicus KeyHub as described in section 16.1 of the manual. Section 16.5 describes the permissions you can assign to this application.

2.2 Create a KeyHubClient object and make an API call

package main

import (
	"context"
	"log"
	"net/http"

	keyhub "github.com/topicuskeyhub/sdk-go"
)

func main() {
	issuer := "<the issuer of your Topicus KeyHub installation>"
	clientid := "<the client id of your application registration>"
	clientsecret := "<the client sercret of your application registration>"

	adapter, err := keyhub.NewKeyHubRequestAdapter(http.DefaultClient, issuer, clientid, clientsecret)
	if err != nil {
		log.Fatalf("Cannot create request adapter: %v\n", err)
	}

	client := keyhub.NewKeyHubClient(adapter)
	me, err := client.Client().Me().Get(context.Background(), nil)
	if err != nil {
		log.Fatalf("Error getting /client/me: %v\n", err)
	}
	log.Printf("me: %s", *me.GetName())
}

sdk-go's People

Contributors

papegaaij avatar haster avatar sboschman avatar

Forkers

sboschman

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.