A short (25-line) JavaScript snippet to call the Okta API from a browser UI – like a mini-rockstar.
Or, copy this code to the browser Console, or, if using Chrome, to a Snippet:
Check out the Source Code
I’ve long been fascinated by the abillity to run arbitrary JavaScript against a website. This can be something simple, like scraping HTML. Or adding a “missing feature” to a website. I started learning about this around 15 years ago when I was using a time tracking website, but I found it tedious and error-prone. I was able to automate data entry with a simple piece of JavaScript.
Now I write more complex scripts like this one. I can add HTML/CSS popups and power them with JavaScript.
Browsers have gotten better at this, too. Chrome, for example, has a fairly complete set of DevTools for writing and debugging JavaScript.
There are a few options for running your JavaScript on someone else’s website:
javascript:
scheme. For example, javascript:alert('hi')
[1]. Note that some browsers remove the javascript:
part if you paste it in, and some browsers or sites block these.javascript:
(function () {
alert('hi');
})(); //Say Hi
[1] Address Bar
[2] Bookmarklet
[3] Chrome DevTools Console
[4] Chrome Snippet