Using SDK with Node/Express

I’d like to send a request from our Node.js backend to Okta to retrieve a token for a given username/password.

I can see this is done using the library ‘@okta/okta-auth-js’ with:
authClient.signIn({
username: “someusername”,
password: “somepassword”
}).then(response =>

However it seems this library is for front end applications only. Is it possible to do this in another way with Node.js and Express?

Hi @bownslabs, any reason why you couldn’t use authjs sdk (in your sample) in your front end app, and use OpenID Connect to get an authorization code to your node backend?

okta-auth-js or the okta-signin-widget will help you manage authentication using the Authentication API, and allow your backend application to understand who the user is with tokens. This is a nicer approach because you may start with username and password now, but in the future need to work with MFA, consent or other features that you would need to orchestrate through your backend. It would be easier to allow the okta client libraries (auth-js or widget) to do that on your behalf.

Also, what are you building? This can give me some more context.

I’m interested in the answer to this question as well. I’m writing an API and I want to validate a username and password against OKTA then sign my own JWT. I have no control over the front end apps.

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