Skip to content

Commit ca91325

Browse files
authored
Merge pull request #55 from RabotaRu/gitlab-auth-fix
Исправлен тип кода ответа для OAuth gitlab
2 parents 3116ccf + 640bd27 commit ca91325

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
node_modules
33
/dist
44
/certs
5+
/gitlab
56

67
/public/workspace/*
78

example.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# URI в формате DocHub корневого манифеста (обязательно)
2-
VUE_APP_DOCHUB_ROOT_MANIFEST=example/root.yaml
2+
VUE_APP_DOCHUB_ROOT_MANIFEST=gitlab:34:main@root.yaml
33

44
# Идентификатор документа главной страницы. По умолчанию dochub_welcome
55
VUE_APP_DOCHUB_ROOT_DOCUMENT=dochub_welcome

src/router/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let middleware = (route) => {
2424
window.location = new URL(
2525
`/oauth/authorize?client_id=${config.oauth.APP_ID}`
2626
+ `&redirect_uri=` + new URL(consts.pages.OAUTH_CALLBACK_PAGE, window.location)
27-
+ `&response_type=token&state=none&scope=${config.oauth.REQUESTED_SCOPES}`
27+
+ `&response_type=code&state=none&scope=${config.oauth.REQUESTED_SCOPES}`
2828
+ '&' + Math.floor(Math.random() * 10000)
2929
, config.gitlab_server
3030
);
@@ -138,7 +138,7 @@ if (process.env.VUE_APP_DOCHUB_MODE !== "plugin") {
138138
path: '/sso/gitlab/authentication',
139139
redirect(route) {
140140
const accessToken = Object.keys(route.query).length
141-
? route.query.access_token
141+
? route.query.access_token || route.query.code
142142
: new URLSearchParams(route.hash.substr(1)).get('access_token');
143143
if (accessToken) {
144144
window.Vuex.dispatch('onReceivedOAuthToken', accessToken);

0 commit comments

Comments
 (0)