when I start the application, I am getting the following error:
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://dev-******.okta.com/oauth2/default/.well-known/openid-configuration": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:751) ~[spring-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
But at the same time I am able to access the url:
https://dev-#######.okta.com/oauth2/default/.well-known/openid-configuration through my web browser. I dont understand why it is refusing to connect through the spring boot application
You might have an IT Trial account instead of a developer account. You can up for a forever-free developer account at https://developer.okta.com/signup.
I followed your link and made a developer account with OKTA. I am still facing the same issue.
Here is the error:
2019-11-13 10:25:19.240 WARN 48732 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration': Unsatisfied dependency expressed through method 'setAuthorizedClientRepository' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authorizedClientRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfiguration.class]: Unsatisfied dependency expressed through method 'authorizedClientRepository' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authorizedClientService' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfiguration.class]: Unsatisfied dependency expressed through method 'authorizedClientService' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method 'clientRegistrationRepository' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of "https://dev-########.okta.com/oauth2/default"
That was it @mraible. Thanks it works fine now.
My company just bought OKTA services/OpenID connect and I was trying these exercises to get started. I forgot I was behind a corporate proxy.
Iâm also facing same but there is no proxy issue at my end.
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name âclientRegistrationRepositoryâ defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method âclientRegistrationRepositoryâ threw exception; nested exception is java.lang.IllegalStateException: The Issuer ââ provided in the configuration metadata did not match the requested issuer ââ
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository]: Factory method âclientRegistrationRepositoryâ threw exception; nested exception is java.lang.IllegalStateException: The Issuer âhttps://dev-887793.okta.com/oauth2/defaultâ provided in the configuration metadata did not match the requested issuer âhttps://dev-887793-admin.okta.com/oauth2/defaultâ
Caused by: java.lang.IllegalStateException: The Issuer âhttps://dev-887793.okta.com/oauth2/defaultâ provided in the configuration metadata did not match the requested issuer âhttps://dev-887793-admin.okta.com/oauth2/defaultâ
Issuer URI shouldnât have -admin part in it. So, in your case, ensure the issuer URI in your config is https://dev-887793.okta.com/oauth2/default and not https://dev-887793-admin.okta.com/oauth2/default, which is what the error indicates.