auth0 / angular-lock

MIT License
18 stars 15 forks source link

callback missmatch error in angular with auth0 #15

Closed LabN36 closed 7 years ago

LabN36 commented 7 years ago

Hi, I'm implementing simple scenario with Auth0 like this What i want

  1. after user login/signup i want to get the user profile and store on my personal database
  2. then i want to return user's JWT to the client side(angular app) so that i can store on local storeag here i dont want to manage session on server side

what i did Angular snipped

var options = { auth: {
          redirectUrl: 'http://localhost:3000/callback'
        , responseType: 'code'
        , params: {
          scope: 'openid name email picture'
        }
  }
}

    lockProvider.init({
      clientID: 'cUlBNhhaI1lxRp6Km',
      domain: 'rishabh.auth0.com',
     option:options
    });

Node snipped

router.get('/callback',
  passport.authenticate('auth0', { failureRedirect: '/url-if-something-fails' }),
  function(req, res) {
    console.log(req.user);
    res.json({id_token:req.user});
  });

Note: I've added this callbacks in auth0 http://localhost:3000/callback but dont know why I'm facing this error for callback error when I've mentioned my redirect URL in angular side

can anyone tell me what is the problem i auth0 not redirecting me to this url http://localhost:3000/callback

what i got callbacmissmatch

the regular webapp example in auth0 uses jade with angular there is not any example that uses both Node anf Angular togather

LabN36 commented 7 years ago

and the interesting thing is when i use simple lock.js instead of angular like this

<script>
var options = { auth: {
          redirectUrl: 'http://localhost:3000/callback'
        , responseType: 'code'
        , params: {
          scope: 'openid name email picture'
        }
  }
}

var lock = new Auth0Lock('clientID', 'rishabh.auth0.com',options);
lock.show();
</script>

then in this case my nodejs /callback route is called properly, so what I'm doing wrong with angular ?

jmangelo commented 7 years ago

This is being investigated in the scope of (http://stackoverflow.com/questions/41236510/callback-missmatch-error-in-angular-with-auth0). If it proves a library caused problem we can get back to GH.