feat: implement OAuth2 authentication flow with Google and PocketId, add callback handling

This commit is contained in:
Marek Lesko
2025-10-28 19:43:46 +00:00
parent 52696196b2
commit ed5cba4677
7 changed files with 200 additions and 89 deletions

View File

@@ -0,0 +1,32 @@
import { Component } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CoreService } from '../../../services/core.service';
import { MaterialModule } from '../../../material.module';
import { BrandingComponent } from '../../../layouts/full/vertical/sidebar/branding.component';
import { AuthenticationService } from '../../../services/authentication.service';
import { JsonPipe, NgIf } from '@angular/common';
import { NgScrollbarModule } from "ngx-scrollbar";
@Component({
selector: 'app-callback',
imports: [RouterModule, MaterialModule, BrandingComponent, JsonPipe, NgIf, NgScrollbarModule],
templateUrl: './callback.component.html',
})
export class CallbackComponent {
options: any;
profile: any;
constructor(private settings: CoreService, private as: AuthenticationService) {
this.options = this.settings.getOptions();
// Handle the OAuth2 callback and load user profile
this.as
.handleCallback()
.then(_ => {
console.log('Login successful');
this.profile = this.as.profile;
}).catch(err => {
console.error('Error handling callback', err);
});
}
}