OIDC flow is slow

I’ve been following the tutorial https://developer.okta.com/blog/2018/09/26/build-a-spring-boot-webapp to integrate my spring boot app with Okta. The end to end flow works, though what we’ve noticed is that when Okta successfully authenticated the user, and redirect to spring app’s authorization-code/callback?code={code}&state={state} endpoint, the request is pretty slow (as bad as 5 second sometimes).

My understanding is this endpoint is abstracted away by com.okta.spring:okta-spring-boot-starter, (we use 1.2.1 version), if so, any advice how we could further troubleshoot the slowness? e.g. enable debug level log?

I created a brand new app with Spring Boot v2.2.2 and the Okta Spring Boot starter v1.3.0. I found that after entering my credentials, it took around 2 seconds to display my name. My app has a simple HomeController that displays the user’s name.

package com.example.demo;

import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.oauth2.core.oidc.user.OidcUser;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

class HomeController {
    public String hello(@AuthenticationPrincipal OidcUser user) {
        return "Hello, " + user.getFullName();

The only other code in it is the Okta dependency in pom.xml and the Okta properties in src/main/resources/application.properties.