Open argelj289 opened 3 years ago
I am having trouble with the application that uses adal-angular4
when I open the app in the new tab,
It asks again for my login although I already logged in.
here is the code I saw in the AppComponent.ts of the app
import { AdalService } from 'adal-angular4'; .... @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit { private adalConfiguration = { tenant: environment.adal.tenant, clientId: environment.adal.clientId, redirectUri: environment.adal.redirectUri, postLogoutRedirectUri: environment.adal.postLogoutRedirectUri, endpoints: environment.adal.endpoints } constructor(private adal: AdalService) { this.adal.init(this.adalConfiguration); } ngOnInit() { this.adal.handleWindowCallback(); if (!this.adal.userInfo.authenticated) { this.adal.login(); } // Log the user information to the console console.log('username ' + this.adal.userInfo.userName); console.log('authenticated: ' + this.adal.userInfo.authenticated); console.log('name: ' + this.adal.userInfo.profile.name); console.log('token: ' + this.adal.userInfo.token); console.log(this.adal.userInfo.profile); sessionStorage.setItem('access_token', this.adal.userInfo.token); } }
Hi, Had the same problem, just set cacheLocation: "localStorage". I found the answer here: https://github.com/benbaran/adal-angular4/issues/118
cacheLocation: "localStorage"
I am having trouble with the application that uses adal-angular4
when I open the app in the new tab,
It asks again for my login although I already logged in.
here is the code I saw in the AppComponent.ts of the app