Handling CLIENT ID in React single page app with OIDC

We are building a Single Page App (SPA) with React and are using the okta-react library to implement OIDC auth flow.

What’s the best way to obtain client id to initialize the okta-react library? The callback URL from Okta points to our SPA which can’t handle POST request. The callback does include issuer in headers but not client id (Also seems like SPAs that use OIDC, only need client_id and client_secret isn’t needed.)

If anyone has experience with this, we really appreciate any advice.

https://developer.okta.com/code/react/

thanks @phi1ipp. Our issue is that when you publish to OIN, every customer has a different CLIENT ID and we are not sure how to pass this to the react library that you linked above.

client_id belongs to an application which you create in your Okta tenant. So not following, what the challenges you are facing?! You assign this client_id in your JS code.

Maybe I’m not quite understanding your use case.

Once the integration is published on OIN (okta integration network), each customer who adds our app to their catalog, will have a new client_id. So seems like Client ID will be different for our different customers, and we won’t be able to hard code it in JS code.

Maybe I am missing something, but we couldn’t find any docs in okta-react app that discusses this.

Oh, I see now. I didn’t get that part that you want to publish in OIN. I think, it’s better for you to reach out to Okta Support to ask for that question, as it’s not something we all do here very often. It has to go through Okta approval anyway, before it’s published

1 Like