Guest User

Untitled

a guest
Apr 25th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. login() {
  2. hello('msft').login({scope: Configs.scope}).then(
  3. () => {
  4. this.zone.run(() => {
  5. this.meService.getMe().subscribe(data => {
  6. localStorage.setItem('username', data.mail);
  7. localStorage.setItem('jobtitle', data.jobTitle);
  8. localStorage.setItem('loggedin', 'yes');
  9. },
  10. err => {
  11. console.log(err);
  12. },
  13. () => {
  14. this.router.navigate(['/home']);
  15. });
  16. });
  17. },
  18. e => console.error(e.error.message)
  19. );
  20. }
  21.  
  22. initAuth() {
  23. this.redirect_uri = window.location.href;
  24. hello.init({
  25. msft: {
  26. id: Configs.appId,
  27. oauth: {
  28. version: 2,
  29. auth: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
  30. },
  31. scope_delim: ' ',
  32. form: false
  33. },
  34. },
  35. {redirect_uri: window.location.href}
  36. );
  37. }
  38.  
  39. getAccessToken() {
  40. const msft = hello('msft').getAuthResponse();
  41. console.log(msft);
  42. const accessToken = msft.access_token;
  43. return accessToken;
  44. }
  45.  
  46. access_token:
  47. "This is private, but it's a very long string"
  48. client_id:"e6c987d2-8bdc-4f1a-bafc-04ba3d51f340"
  49. display:"popup"
  50. expires:1524649746.548
  51. expires_in:3599
  52. network:"msft"
  53. redirect_uri:"http://localhost:4200/"
  54. scope:"basic,User.Read"
  55. session_state:"89a68bd2-5ae5-4df2-88d0-d28718fd10bc"
  56. state:""
  57. token_type:"Bearer"
Add Comment
Please, Sign In to add comment