From 803eccf8cb0f9601296949ca589d6bba67210996 Mon Sep 17 00:00:00 2001 From: M Hickford Date: Mon, 22 Jul 2024 09:54:51 +0100 Subject: [PATCH] endpoints: add GitLab DeviceAuthURL https://docs.gitlab.com/ee/api/oauth2.html#device-authorization-grant-flow --- endpoints/endpoints.go | 5 +++-- gitlab/gitlab.go | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/endpoints/endpoints.go b/endpoints/endpoints.go index 89ed30f2a..094b5594f 100644 --- a/endpoints/endpoints.go +++ b/endpoints/endpoints.go @@ -62,8 +62,9 @@ var GitHub = oauth2.Endpoint{ // GitLab is the endpoint for GitLab. var GitLab = oauth2.Endpoint{ - AuthURL: "https://gitlab.com/oauth/authorize", - TokenURL: "https://gitlab.com/oauth/token", + AuthURL: "https://gitlab.com/oauth/authorize", + TokenURL: "https://gitlab.com/oauth/token", + DeviceAuthURL: "https://gitlab.example.com/oauth/authorize_device", } // Google is the endpoint for Google. diff --git a/gitlab/gitlab.go b/gitlab/gitlab.go index 1231d75ac..aea2dfe50 100644 --- a/gitlab/gitlab.go +++ b/gitlab/gitlab.go @@ -6,11 +6,8 @@ package gitlab // import "golang.org/x/oauth2/gitlab" import ( - "golang.org/x/oauth2" + "golang.org/x/oauth2/endpoints" ) // Endpoint is GitLab's OAuth 2.0 endpoint. -var Endpoint = oauth2.Endpoint{ - AuthURL: "https://gitlab.com/oauth/authorize", - TokenURL: "https://gitlab.com/oauth/token", -} +var Endpoint = endpoints.GitLab