diff --git a/gitlab.go b/gitlab.go index 141510e58..41fdc303f 100644 --- a/gitlab.go +++ b/gitlab.go @@ -834,3 +834,14 @@ func parseError(raw interface{}) string { return fmt.Sprintf("failed to parse unexpected error type: %T", raw) } } + +// WithToken сhanges the token, but does not change the authorization method. +// For change authorization method create new Client. +func (c *Client) WithToken(token string) *Client { + c.tokenLock.Lock() + defer c.tokenLock.Unlock() + + c.token = token + + return c +}