post review fixes

This commit is contained in:
Krzysztof Dukszta-Kwiatkowski
2023-05-25 15:13:21 +02:00
committed by Ali BARIN
parent 3f8f022d48
commit 6e80ff4eb6
37 changed files with 94 additions and 75 deletions

View File

@@ -1,5 +1,6 @@
import { IGlobalVariable } from '@automatisch/types';
import { URLSearchParams } from 'url';
import getBaseUrl from '../common/get-base-url';
export default async function generateAuthUrl($: IGlobalVariable) {
// ref: https://docs.gitlab.com/ee/api/oauth2.html#authorization-code-flow
@@ -11,14 +12,13 @@ export default async function generateAuthUrl($: IGlobalVariable) {
redirect_uri: $.auth.data.oAuthRedirectUrl as string,
scope: scopes.join(' '),
response_type: 'code',
state: `${Date.now()}`,
state: Date.now().toString(),
});
const url = `${
$.auth.data.oInstanceUrl
}/oauth/authorize?${searchParams.toString()}`;
const baseUrl = getBaseUrl($);
const path = `/oauth/authorize?${searchParams.toString()}`;
await $.auth.set({
url,
url: baseUrl + path,
});
}