mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-28 02:19:07 +00:00
return auth url on first clik
This commit is contained in:
@@ -143,7 +143,6 @@ class sheet {
|
|||||||
*/
|
*/
|
||||||
public async openAuthServer(): Promise<string | false> {
|
public async openAuthServer(): Promise<string | false> {
|
||||||
//TODO: this only works on local networks
|
//TODO: this only works on local networks
|
||||||
//FIXME: the authUrl is not returnd before the second call
|
|
||||||
if (sheet.authUrl) {
|
if (sheet.authUrl) {
|
||||||
return sheet.authUrl;
|
return sheet.authUrl;
|
||||||
}
|
}
|
||||||
@@ -213,20 +212,19 @@ class sheet {
|
|||||||
} else if (redirectUri.port !== '') {
|
} else if (redirectUri.port !== '') {
|
||||||
listenPort = Number(redirectUri.port);
|
listenPort = Number(redirectUri.port);
|
||||||
}
|
}
|
||||||
server.listen(listenPort, () => {
|
//FIXME: the server might not start correctly
|
||||||
const address = server.address();
|
server.listen(listenPort, () => {});
|
||||||
if (typeof address !== 'string') {
|
const address = server.address();
|
||||||
redirectUri.port = String(address.port);
|
if (typeof address !== 'string') {
|
||||||
}
|
redirectUri.port = String(address.port);
|
||||||
// open the browser to the authorize url to start the workflow
|
}
|
||||||
const authorizeUrl = client.generateAuthUrl({
|
// open the browser to the authorize url to start the workflow
|
||||||
redirect_uri: redirectUri.toString(),
|
const authorizeUrl = client.generateAuthUrl({
|
||||||
access_type: 'offline',
|
redirect_uri: redirectUri.toString(),
|
||||||
scope: this.scope,
|
access_type: 'offline',
|
||||||
});
|
scope: this.scope,
|
||||||
sheet.authUrl = authorizeUrl;
|
|
||||||
return authorizeUrl;
|
|
||||||
});
|
});
|
||||||
|
sheet.authUrl = authorizeUrl;
|
||||||
setTimeout(
|
setTimeout(
|
||||||
() => {
|
() => {
|
||||||
sheet.authUrl = null;
|
sheet.authUrl = null;
|
||||||
@@ -234,6 +232,7 @@ class sheet {
|
|||||||
},
|
},
|
||||||
2 * 60 * 1000,
|
2 * 60 * 1000,
|
||||||
);
|
);
|
||||||
|
return authorizeUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user