MCPcopy
hub / github.com/mislav/hub / isToken

Function isToken

github/client.go:950–960  ·  view source on GitHub ↗
(api *simpleClient, password string)

Source from the content-addressed store, hash-verified

948}
949
950func isToken(api *simpleClient, password string) bool {
951 api.PrepareRequest = func(req *http.Request) {
952 req.Header.Set("Authorization", "token "+password)
953 }
954
955 res, _ := api.Get("user")
956 if res != nil && res.StatusCode == 200 {
957 return true
958 }
959 return false
960}
961
962func (client *Client) FindOrCreateToken(user, password, twoFactorCode string) (token string, err error) {
963 api := client.apiClient()

Callers 1

FindOrCreateTokenMethod · 0.85

Calls 2

GetMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…