Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 28e217d

Browse files
authored
Merge pull request #496 from talam/update_gitlab_api_endpoint
providers: update gitlab api endpoint to use latest version, v4
2 parents bfda078 + f2a995b commit 28e217d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ If you are using self-hosted GitLab, make sure you set the following to the appr
114114

115115
-login-url="<your gitlab url>/oauth/authorize"
116116
-redeem-url="<your gitlab url>/oauth/token"
117-
-validate-url="<your gitlab url>/api/v3/user"
117+
-validate-url="<your gitlab url>/api/v4/user"
118118

119119

120120
### LinkedIn Auth Provider

providers/gitlab.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func NewGitLabProvider(p *ProviderData) *GitLabProvider {
3232
p.ValidateURL = &url.URL{
3333
Scheme: "https",
3434
Host: "gitlab.com",
35-
Path: "/api/v3/user",
35+
Path: "/api/v4/user",
3636
}
3737
}
3838
if p.Scope == "" {

providers/gitlab_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func testGitLabProvider(hostname string) *GitLabProvider {
2828
}
2929

3030
func testGitLabBackend(payload string) *httptest.Server {
31-
path := "/api/v3/user"
31+
path := "/api/v4/user"
3232
query := "access_token=imaginary_access_token"
3333

3434
return httptest.NewServer(http.HandlerFunc(
@@ -51,7 +51,7 @@ func TestGitLabProviderDefaults(t *testing.T) {
5151
p.Data().LoginURL.String())
5252
assert.Equal(t, "https://gitlab.com/oauth/token",
5353
p.Data().RedeemURL.String())
54-
assert.Equal(t, "https://gitlab.com/api/v3/user",
54+
assert.Equal(t, "https://gitlab.com/api/v4/user",
5555
p.Data().ValidateURL.String())
5656
assert.Equal(t, "read_user", p.Data().Scope)
5757
}
@@ -70,15 +70,15 @@ func TestGitLabProviderOverrides(t *testing.T) {
7070
ValidateURL: &url.URL{
7171
Scheme: "https",
7272
Host: "example.com",
73-
Path: "/api/v3/user"},
73+
Path: "/api/v4/user"},
7474
Scope: "profile"})
7575
assert.NotEqual(t, nil, p)
7676
assert.Equal(t, "GitLab", p.Data().ProviderName)
7777
assert.Equal(t, "https://example.com/oauth/auth",
7878
p.Data().LoginURL.String())
7979
assert.Equal(t, "https://example.com/oauth/token",
8080
p.Data().RedeemURL.String())
81-
assert.Equal(t, "https://example.com/api/v3/user",
81+
assert.Equal(t, "https://example.com/api/v4/user",
8282
p.Data().ValidateURL.String())
8383
assert.Equal(t, "profile", p.Data().Scope)
8484
}

0 commit comments

Comments
 (0)