SHARE
TWEET

Untitled

a guest Aug 17th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component, OnInit } from '@angular/core';
  2. import { ActivatedRoute } from '@angular/router';
  3. import { SessionService } from '../session.service';
  4. @Component({
  5.   selector: 'app-settings-page',
  6.   templateUrl: './settings-page.component.html',
  7.   styleUrls: ['./settings-page.component.scss']
  8. })
  9. export class SettingsPageComponent implements OnInit {
  10.   constructor(
  11.     private activatedRoute: ActivatedRoute,
  12.     private sessionService: SessionService,
  13.   ) {
  14.     this.activatedRoute.queryParams.subscribe(params => {
  15.       const oauthVerifier = params['oauth_verifier'];
  16.       const oauthToken = params['oauth_token'];
  17.       if (oauthToken && oauthVerifier) {
  18.         this.saveAccessToken(oauthToken, oauthVerifier);
  19.       }
  20.     });
  21.   }
  22.   ngOnInit() {}
  23.   saveAccessToken(oauthToken: string, oauthVerifier: string) {
  24.     this.sessionService.saveAccessToken(oauthToken, oauthVerifier).subscribe(res => {
  25.     alert('Token saved');
  26.     })
  27.   }
  28.   redirectToTwitter() {
  29.     this.sessionService.getRedirectUrl().subscribe((res: any) => {
  30.       location.href = res.redirectUrl;
  31.     })
  32.   }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top