Angular & Spring can't comunicate using Okta

We have SPA(Single page application), all was done according to this article https://developer.okta.com/quickstart/?_ga=2.166342014.190164458.1571852858-744440357.1570208274#/angular/java/spring
So we have java and angular.
We have next environments dev1, dev2.
dev1 and dev2 use same issuer, but different client ids
I have an issue on dev2, angular able to connect to okta and sign in, but when it sends any requests to spring backend it gets 401 response.
What could be a problem?
Okta team told me they see login logs, and see that I logged in, so angular works fine, on Spring side, I just have maven depdendency:

com.okta.spring
okta-spring-boot-starter
1.2.1

and spring config:
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/myapi/**").fullyAuthenticated()
.anyRequest().permitAll();
}
and two application.yml files for okta properties for dev1 and dev2 environments, with different client_ids:
okta:
oauth2:
issuer: https://ourorg-dev.oktapreview.com/oauth2/issuer_id
client-id: different_client_id
If remove this all works fine, but then all API will be used without any authentication.
What could be a problem?
I believe may be some properties set different for different environments, but our okta team tells me that they have same properties for both environments.
I have no Spring logs, no errors, don’t know what to search.
All I could find it’s in
package java.net;
in class DualStackPlainSocketImpl
method socketConnect
throws ConnectException on line
connect0(nativefd, address, port);
with parameters nativd fd - some number
address - ourcompany-dev.oktapreview.com/34.236.some_ip
port 443
Looks like it tries to create socket connection, but no luck
That’s all I know.
What could be a problem? Why angular with same code can connect to spring on one environment and can’t on another? Main difference from my side is client id, I can’t see Okta properties, but Okta team tells me that Okta properties same for both environments.
Pleas help!

What version of Spring Boot are you using? If you’re using 2.1.x, you should use 1.3.0+ of our Spring Boot starter. If you take the working version and use the same properties in your 2nd app, does it work? If so, then it sounds like your 2nd (non-working) app is not registered correctly with Okta (or your code is different). If it does not work, then I’m guessing it’s something different in your code.

Spring parent using:
org.springframework.boot
spring-boot-starter-parent
2.1.6.RELEASE
I’m using same code on both environments, only change client id, and it works on dev1, but doesn’t work on dev2. And Okta team tells me that they have same properties for both environments, I don’t know how to demonstrate them that problem on their side, and I don’t know what properties they should change and I just don’t know what to do.

Are you able to share your code with me, using a GitHub repo or something similar? Maybe you could create a couple new Spring Boot apps to demonstrate the problem?

Looks like we just had some firewall issue

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