fix: library login fails

This commit is contained in:
2023-10-17 18:00:55 +02:00
parent 656f2266e3
commit ef092a8bff
7 changed files with 17 additions and 49 deletions
@@ -16,25 +16,27 @@ import {Component} from '@angular/core';
import {NavController} from '@ionic/angular';
import {Router} from '@angular/router';
import {AuthActions, IAuthAction} from 'ionic-appauth';
import {SCAuthorizationProviderType} from '@openstapps/core';
import {AuthHelperService} from '../../auth-helper.service';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {Observable} from 'rxjs';
import {IPAIAAuthAction} from '../../paia/paia-auth-action';
import {DefaultAuthService} from '../../default-auth.service';
@Component({
templateUrl: 'auth-callback-page.component.html',
styleUrls: ['auth-callback-page.component.scss'],
})
export class AuthCallbackPageComponent {
PROVIDER_TYPE: SCAuthorizationProviderType = 'default';
constructor(private navCtrl: NavController, private router: Router, private authHelper: AuthHelperService) {
const provider = this.authHelper.getProvider(this.PROVIDER_TYPE);
const events: Observable<IPAIAAuthAction | IAuthAction> = provider.events$;
constructor(
private navCtrl: NavController,
private router: Router,
private authHelper: AuthHelperService,
private auth: DefaultAuthService,
) {
const events: Observable<IPAIAAuthAction | IAuthAction> = this.auth.events$;
events.pipe(takeUntilDestroyed()).subscribe((action: IAuthAction) => this.postCallback(action));
provider.authorizationCallback(window.location.origin + this.router.url);
this.auth.authorizationCallback(window.location.origin + this.router.url);
}
async postCallback(action: IAuthAction) {