Getting authsdk Error: Client ID must be specified

Hi Team,

I am getting below error

AuthSdkError: A clientId must be specified in the OktaAuth constructor to get a token

Can anyone please help here ?

Hi @er.gauravgoyal. Which SDK are you using, and which version?

1 Like

Hey @louie : I am using below npm packages
β€œ@okta/okta-auth-js”: β€œ^6.7.1”,
β€œ@okta/okta-react”: β€œ^6.5.0”,

Hi @er.gauravgoyal! Double checking, did you add a client id to your OktaAuth constructor per - GitHub - okta/okta-react: Okta OIDC SDK for React.

import { useHistory } from 'react-router-dom';
import { OktaAuth, toRelativeUrl } from '@okta/okta-auth-js';

const oktaAuth = new OktaAuth({
  issuer: 'https://{yourOktaDomain}/oauth2/default',
  clientId: '{clientId}',
  redirectUri: window.location.origin + '/login/callback'
});
1 Like