Javascript/Jquery add new user example code?

Does something like this exist? For some reason I can’t seem to find any full examples of code using JS to do anthing other than use the login widget.

Trying to add new users using JS and an API token key. I have done this through C# before. Anyone point me to something?

You typically don’t want to do this purely in JS, because keeping an Okta API token in the browser is very dangerous. The API token should only be used from backend code, because otherwise it would be trivial to steal.

The solution today is to write this code on your backend (in C#, or whatever language you’re using) and call it from the browser as needed.

Later on, we’ll be rolling out new features to the widget including the ability to register a new account. It’s not ready yet but that will make it easier to let users sign up, without having to write custom code.

this was really just for my own understanding. do not plan to actually use it that way. It is more a conceptual things just to learn a bit more.

Gotcha. If you want, you can certainly make HTTP calls to the Create User API from your code.

None of our client-side JavaScript SDKs include this functionality, for the security reason I mentioned above. Our Node SDK does, because it’s meant to be used on the backend. Hope this makes things a little clearer. :+1:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.