Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- login() {
- hello('msft').login({scope: Configs.scope}).then(
- () => {
- this.zone.run(() => {
- this.meService.getMe().subscribe(data => {
- localStorage.setItem('username', data.mail);
- localStorage.setItem('jobtitle', data.jobTitle);
- localStorage.setItem('loggedin', 'yes');
- },
- err => {
- console.log(err);
- },
- () => {
- this.router.navigate(['/home']);
- });
- });
- },
- e => console.error(e.error.message)
- );
- }
- initAuth() {
- this.redirect_uri = window.location.href;
- hello.init({
- msft: {
- id: Configs.appId,
- oauth: {
- version: 2,
- auth: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
- },
- scope_delim: ' ',
- form: false
- },
- },
- {redirect_uri: window.location.href}
- );
- }
- getAccessToken() {
- const msft = hello('msft').getAuthResponse();
- console.log(msft);
- const accessToken = msft.access_token;
- return accessToken;
- }
- access_token:
- "This is private, but it's a very long string"
- client_id:"e6c987d2-8bdc-4f1a-bafc-04ba3d51f340"
- display:"popup"
- expires:1524649746.548
- expires_in:3599
- network:"msft"
- redirect_uri:"http://localhost:4200/"
- scope:"basic,User.Read"
- session_state:"89a68bd2-5ae5-4df2-88d0-d28718fd10bc"
- state:""
- token_type:"Bearer"
Add Comment
Please, Sign In to add comment