MCPcopy Index your code
hub / github.com/koding/kite / GetToken

Method GetToken

kontrolclient.go:187–206  ·  view source on GitHub ↗

GetToken is used to get a token for a single Kite. In case of calling GetToken multiple times, it usually returns the same token until it expires on Kontrol side.

(kite *protocol.Kite)

Source from the content-addressed store, hash-verified

185// In case of calling GetToken multiple times, it usually
186// returns the same token until it expires on Kontrol side.
187func (k *Kite) GetToken(kite *protocol.Kite) (string, error) {
188 if err := k.SetupKontrolClient(); err != nil {
189 return "", err
190 }
191
192 <-k.kontrol.readyConnected
193
194 result, err := k.kontrol.TellWithTimeout("getToken", k.Config.Timeout, kite)
195 if err != nil {
196 return "", err
197 }
198
199 var tkn string
200 err = result.Unmarshal(&tkn)
201 if err != nil {
202 return "", err
203 }
204
205 return tkn, nil
206}
207
208// SendWebRTCRequest sends requests to kontrol for signalling purposes.
209func (k *Kite) SendWebRTCRequest(req *protocol.WebRTCSignalMessage) error {

Callers 6

renewTokenMethod · 0.80
TestRegisterDenyEvilFunction · 0.80
TestTokenInvalidationFunction · 0.80
TestGetTokenFunction · 0.80
TestKontrolFunction · 0.80
TestKontrolMultiKeyFunction · 0.80

Calls 3

SetupKontrolClientMethod · 0.95
TellWithTimeoutMethod · 0.80
UnmarshalMethod · 0.80

Tested by 5

TestRegisterDenyEvilFunction · 0.64
TestTokenInvalidationFunction · 0.64
TestGetTokenFunction · 0.64
TestKontrolFunction · 0.64
TestKontrolMultiKeyFunction · 0.64