samples-js-react icon indicating copy to clipboard operation
samples-js-react copied to clipboard

Works fine in developer account, but not in organisation account

Open premkumar-gg opened this issue 8 years ago • 3 comments

I followed the instructions here: https://github.com/okta/samples-js-react/tree/master/okta-hosted-login

And here: https://github.com/okta/samples-java-spring/tree/master/resource-server

...to set up a sample reactjs app authenticating with Okta.

Worked like a charm with my developer Okta account.

But when I tried to use my organisation's Okta configurations, I'm encounter errors while trying to bring up the resource server.

Here are the configurations in my application.yml:

okta:
  oauth2:
    issuer: "https://<myOrgName>.okta-emea.com/oauth2/default"
    client-id: "<myClientId>"
    client-secret: "<myClientSecret>"

I created a new application in Okta developer console with a Web configuration, which gave me the clientId and clientSecret.

And when I do this:

cd resource-server
mvn

I see this error:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) on project okta-spring-boot-oauth-resource-server: An exception occurred while running. null: InvocationTargetException: Failed to process import candidates for configuration class [org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerConfiguration]; nested exception is java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerTokenServicesConfiguration$JwkTokenStoreConfiguration: 401 Unauthorized -> [Help 1]

Any pointers on what I'm missing? How can I troubleshoot what is going wrong? Any logs in Okta?

premkumar-gg avatar May 31 '18 11:05 premkumar-gg

Hi @premkumar-gg,

Couple of reasons this could be happening.

  1. Okta's Developer accounts have a default authorization server included as a part of the API Access Management product. You can validate if you have this feature enabled for your production org by visiting the meta-data endpoint: https://{yourOktaName}.okta-emea.com/oauth2/default/.well-known/oauth-authorization-server.
    • If you get a JSON response, you should have this enabled. If not, please contact [email protected]
  2. Your resource server is returning a 401 unauthorized error. It is possible that your frontend is requesting tokens for your dev org, while your resource server is expecting them to be from your production org. Verify that the issuer claim is equal for both.

Hope this provides a bit if guidance!

jmelberg-okta avatar Jun 25 '18 17:06 jmelberg-okta

@premkumar-gg Some time has passed since this issue was filed. Were you able to resolve the issue?

aarongranick-okta avatar Nov 25 '19 20:11 aarongranick-okta

It was quite some time ago. From what I remember, it happened that my organisation account package has not subscribed to the Okta APIs. The RoI for the cost of changing the subscription was not suitable, so we had to drop the idea.

premkumar-gg avatar Nov 25 '19 22:11 premkumar-gg