diff --git a/cmd/server.go b/cmd/server.go
index 648d0d18..88170c9c 100644
--- a/cmd/server.go
+++ b/cmd/server.go
@@ -258,7 +258,9 @@ func (o *serverOption) runE(cmd *cobra.Command, args []string) (err error) {
ClientID: o.clientID,
ClientSecret: o.clientSecret,
}, o.oauthSkipTls)
- mux.HandlePath(http.MethodGet, "/token", authHandler.RequestCode)
+ mux.HandlePath(http.MethodGet, "/oauth2/token", authHandler.RequestCode)
+ mux.HandlePath(http.MethodGet, "/oauth2/getLocalCode", authHandler.RequestLocalCode)
+ mux.HandlePath(http.MethodGet, "/oauth2/getUserInfoFromLocalCode", authHandler.RequestLocalToken)
mux.HandlePath(http.MethodGet, "/oauth2/callback", authHandler.Callback)
}
diff --git a/cmd/service_test.go b/cmd/service_test.go
index 9c7464bd..70e80952 100644
--- a/cmd/service_test.go
+++ b/cmd/service_test.go
@@ -1,3 +1,27 @@
+/*
+MIT License
+
+Copyright (c) 2023 API Testing Authors.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
package cmd
import (
diff --git a/console/atest-ui/src/App.vue b/console/atest-ui/src/App.vue
index de1fac79..27c50b0d 100644
--- a/console/atest-ui/src/App.vue
+++ b/console/atest-ui/src/App.vue
@@ -292,6 +292,28 @@ watch(viewName, (val) => {
});
})
+const deviceAuthActive = ref(0)
+const deviceAuthResponse = ref({
+ user_code: '',
+ verification_uri: '',
+ device_code: ''
+})
+const deviceAuthNext = () => {
+ if (deviceAuthActive.value++ > 2) {
+ return
+ }
+
+ if (deviceAuthActive.value === 1) {
+ fetch('/oauth2/getLocalCode')
+ .then(API.DefaultResponseProcess)
+ .then((d) => {
+ deviceAuthResponse.value = d
+ })
+ } else if (deviceAuthActive.value === 2) {
+ window.location.href = '/oauth2/getUserInfoFromLocalCode?device_code=' + deviceAuthResponse.value.device_code
+ }
+}
+
const suiteKinds = [{
"name": "HTTP",
}, {
@@ -311,7 +333,6 @@ API.GetVersion((d) => {
return
}
- console.log(dirtyVersion)
if (dirtyVersion && dirtyVersion.length > 0) {
appVersionLink.value = appVersionLink.value + '/commit/' + d.message.replace(dirtyVersion[0], '')
} else if (version && version.length > 0) {
@@ -491,11 +512,27 @@ API.GetVersion((d) => {
title="You need to login first."
width="30%"
>
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Open this link, and type the code: {{ deviceAuthResponse.user_code }}. Then click the next step button.
+