Another oauth question

Hi all,

I’m hacking my way round authentication with Auth0, and I’ve basically got it working.

However, I want to put the JWT/id_token into the wappler session.

I’ve got the session storage manager set up on every page, with the right variables, and I can set a variable on one page and have it alerted on another.

But how can I set it from plain javascript which I’ve got running in the raw code view?

Regards,
Andy

Hi,
You are looking to set Wappler created session from JS, is that right?

That’s correct Sid.

I’ve changed the topic title, as I’d started drafting an oauth-related question, resolved that, and then encountered the session problem.

Regards,
Andy

In the code below I first store the value in a global variable and then use an expression to set the global variable in the session storage.

dmx.global.set('token', token);
dmx.parse('session1.set(token)');
2 Likes

Thats a new command.
What happens if I directly set a value by concatenating string and variable inside parse method?

Ah, that looks great. I’ll set if I can get that working tonight after I’ve finished this annoying day-job :wink:

Many thanks

Thanks Patrick, you got me in the right direction.

Final answer was:

dmx.global.set('token', authResult.idToken);
dmx.parse('session1.set("test",token,{})');

Andy

Oh, one more note in case it’s useful - the session isn’t dynamically updated in the app at the it’s set. The page has to refresh or redirect to another page before the new session value is “live”.