import { LoginService } from '../../utilties/login-service'; import { ActivatedRoute, Router } from '@angular/router'; import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-twitter-login', templateUrl: './twitter-login.component.html', }) export class TwitterLoginComponent implements OnInit { constructor( private router: Router, private route: ActivatedRoute, private loginService: LoginService ) { } ngOnInit(): void { this.route.queryParams.subscribe((data: any) => { if (!data['oauth_token'] && !data['oauth_verifier']) { this.loginService.twitterAuthorize(); } else { this.loginService.twitterLogin(data['oauth_token'], data['oauth_verifier']); } }); } }