Auth0 Home Blog Docs

Angular 2 inside Electron, but no popup

electron
auth0js
angular2

#1

I’m trying to get auth0-js working inside Angular 2 inside an electron app. I have it set up as a service. For the most part it works. I can login but the redirect doesn’t work, so I thought I would try the pop up method. Here is my baseline with no popup.

import auth0 from 'auth0-js';
public auth0 = new auth0.WebAuth({
    clientID: AUTH_CONFIG.clientID,
    domain: AUTH_CONFIG.domain,
    responseType: 'token id_token',
    audience: `https://${AUTH_CONFIG.domain}/userinfo`,
    scope: 'openid',
  });
  public login(): void {
    this.auth0.authorize({
    }); }

I know I should use popup but where? Here is what I’ve tried to do and failed…

  public login(): void {
    this.auth0.popup.authorize({
    }); }

---------failed

  public login(): void {
    this.auth0.authorize.popup({
    }); }

-------failed

  public auth0 = new auth0.popup.WebAuth({
    clientID: AUTH_CONFIG.clientID,
    domain: AUTH_CONFIG.domain,
    responseType: 'token id_token',
    audience: `https://${AUTH_CONFIG.domain}/userinfo`,
    scope: 'openid',
  });
  constructor(public router: Router) { }
  public login(): void {
    this.auth0.authorize({
    }); }

------------failed

  public auth0 = new auth0.WebAuth.popup({
    clientID: AUTH_CONFIG.clientID,
    domain: AUTH_CONFIG.domain,
    responseType: 'token id_token',
    audience: `https://${AUTH_CONFIG.domain}/userinfo`,
    scope: 'openid',
  });
  constructor(public router: Router) { }
  public login(): void {
    this.auth0.authorize({
    }); }

----------failed

 public auth0 = new auth0.WebAuth({
    clientID: AUTH_CONFIG.clientID,
    domain: AUTH_CONFIG.domain,
    responseType: 'token id_token',
    audience: `https://${AUTH_CONFIG.domain}/userinfo`,
    scope: 'openid',
    popup: true,
  });
  constructor(public router: Router) { }
  public login(): void {
    this.auth0.authorize({
    }); }

--------failed

  public auth0 = new auth0.WebAuth({
    clientID: AUTH_CONFIG.clientID,
    domain: AUTH_CONFIG.domain,
    responseType: 'token id_token',
    audience: `https://${AUTH_CONFIG.domain}/userinfo`,
    scope: 'openid',
  });
  constructor(public router: Router) { }
  public login(): void {
    this.auth0.authorize({
      popup: true,
    }); }

------failed

  public auth0 = new auth0.WebAuth({
    clientID: AUTH_CONFIG.clientID,
    domain: AUTH_CONFIG.domain,
    responseType: 'token id_token',
    audience: `https://${AUTH_CONFIG.domain}/userinfo`,
    scope: 'openid',
  });
  constructor(public router: Router) { }
  public login(): void {
    this.auth0.popup({
    }); }

----------failed

I’m running out of ideas of where to put it.

Any suggestions?


#2