firebase.auth().signInWithRedirect(provider);
firebase.auth().getRedirectResult().then(function (result) {
if (result.credential) {
// This gives you a Google Access Token.
var token = result.credential.accessToken;
}
var user = result.user;
}).catch(function (error) {
// Handle Errors here.
console.log(error)
// ...
});
// Start a sign in process for an unauthenticated user.
firebase.auth().onAuthStateChanged(user => {
if (user) {
$state.go('home');
}
})
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用 Google 登录,但它总是将我重定向回我的登录页面,然后在一段时间后它重定向到主页。单击登录按钮后,它会重定向到 Google 身份验证并返回登录页面。如何避免这种情况?
google-authentication angularjs firebase firebase-authentication
我正在使用此代码进行路由
{ path: 'dashboard', loadChildren: './dashboard#DashboardModule'},
{ path: '', children: [
{ path: '', component:DashboardComponent, children: [
{ path: '', redirectTo:'dashboard/first',pathMatch:'full' },
{ path: 'first', component: FirstComponent },
{ path: 'second', component: SecondComponent }]
},
]},
Run Code Online (Sandbox Code Playgroud)
在这里,当URL是/dashboard我需要它路由到/dashboard/first...
我该如何实现?