feat: implement OAuth2 authentication flow with Google and PocketId, add callback handling
This commit is contained in:
32
Web/src/app/pages/authentication/callback/callback.component.ts
Executable file
32
Web/src/app/pages/authentication/callback/callback.component.ts
Executable 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);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user