| 38 | } |
| 39 | |
| 40 | func (c gitlabOauthClient) buildLoginURL(state string) (string, error) { |
| 41 | u, err := url.Parse(c.AuthLocation) |
| 42 | if err != nil { |
| 43 | return "", err |
| 44 | } |
| 45 | q := u.Query() |
| 46 | q.Set("client_id", c.ClientID) |
| 47 | q.Set("redirect_uri", c.CallbackLocation) |
| 48 | q.Set("response_type", "code") |
| 49 | q.Set("state", state) |
| 50 | q.Set("scope", "read_user") |
| 51 | u.RawQuery = q.Encode() |
| 52 | return u.String(), nil |
| 53 | } |
| 54 | |
| 55 | func (c gitlabOauthClient) exchangeOauthCode(ctx context.Context, code string) (*TokenResponse, error) { |
| 56 | form := url.Values{} |