Error: Your client ID is missing

Hi all, I am currently working my way through this blog post/tutorial for my studies:

and i am trapped around Build a Simple REST API with Node and OAuth 2.0 | Okta Developer

I have added all the needed vars in my .env file. However, i still get this error trying to run at the end of that section:

 throw new ConfigurationValidationError('Your client ID is missing. ' + copyCredentialsMessage);
^
 Error: Your client ID is missing. You can copy it from the Okta Developer Console in the details for the 
Application you created. Follow these instructions to find it: https://bit.ly/finding-okta-app-credentials

I know my .env file loads. If i delete ISSUER or SCOPE, i get errors that they no longer exist. I am a student and new to this process and was hoping maybe it was a simple solution I am overlooking.

Someone also commented with the same issue on the blog post, so it seems it may not be an uncommon issue.

Thanks so much!

Edited to add full stacktrace:

PATH_TO_PROJECT/node_modules/@okta/configuration-validation/dist/lib.js:66
throw new ConfigurationValidationError('Your client ID is missing. ' + copyCredentialsMessage);
^

Error: Your client ID is missing. You can copy it from the Okta Developer Console in the details for the Application you created. Follow these instructions to find it: https://bit.ly/finding-okta-app-credentials
at new ConfigurationValidationError (PATH_TO_PROJECT/node_modules/@okta/configuration-validation/dist/lib.js:27:141)
at configUtil.assertClientId (PATH_TO_PROJECT/node_modules/@okta/configuration-validation/dist/lib.js:66:11)
at new OktaJwtVerifier (PATH_TO_PROJECT/node_modules/@okta/jwt-verifier/lib.js:25:5)
at Object.<anonymous> (PATH_TO_PROJECT/auth.js:4:25)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)

Do you have a stacktrace you can include?

Hi there, thanks for replying - I updated my original post to include the stack trace.

1 Like

Try adding the clientId to the OktaJwtVerifier constructor:

const oktaJwtVerifier = new OktaJwtVerifier({ 
    issuer: process.env.ISSUER,
    clientId: process.env.CLIENT_ID
})

We will get someone to update the post!

Let us know if that doesn’t fix your issue!

1 Like

That simple swap did the trick - thank you for the quick help!

1 Like

This change does do the trick. However the documentation on the GitHub for the OktaJWTVerifier does not show the proper configuration. Furthermore the documentation there specifically shows wrong configuration:

const verifier = new OktaJwtVerifier({
issuer: ISSUER,
assertClaims: {
cid: ‘{clientId}’
}
});

Which also blows up because the clientId is specified a) in the wrong place and b) withthe wrong label.

Would you please fix the documentation?

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