use the new login function

This commit is contained in:
Sven Czarnian
2022-11-05 00:52:18 +01:00
parent 29e134880d
commit ac257d1d2e
2 changed files with 14 additions and 14 deletions

View File

@@ -9,6 +9,18 @@ import {
} from '../types';
export class Auth {
static triggerLoginFlow(): void {
const url = [
Configuration.vatsim.authorizeUrl,
`?client_id=${Configuration.vatsim.clientId}`,
`&redirect_uri=${Configuration.resourceServer}/auth/vatsim`,
`&response_type=code`,
`&scope=full_name+vatsim_details`,
`&approval_prompt=auto`,
].join('');
window.location.replace(url);
}
static async tokenIsValid(): Promise<BackendReturnStatus> {
const token = Session.bearerToken();
if (!token) return BackendReturnStatus.Unauthorized;