我有我的组件,我创建了应该将我重定向到auth0页面的方法。
我发现的每条信息都是关于router.redirect [/ page]之类的,但是我需要重定向到另一个域,特别是auth0。
我的组件
import { AuthService } from 'src/app/services/auth.service';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { tokenGetter } from 'src/app/app.module';
import { ActivatedRoute } from '@angular/router';
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.css']
})
export class RegisterComponent implements OnInit {
token: string;
profile: any;
constructor(private http: HttpClient,private activatedRoute: ActivatedRoute, private auth: AuthService) {
}
ngOnInit() {
this.activatedRoute.queryParams.subscribe(params => {
const token = params['userId'];
const state = params['state'];
this.document.location.href = 'https://'+environment.domain+"/continue"+"?state="+state;
}
);
}
}
我发现该文档已弃用。