Example authorization-code/callback

Where can I find an example authorization-code/callback in java?

This is for the spring-boot quickstart. The tutorial is incomplete. It tells us how to redirect to okta, but could use an example of the callback needed to get the whole process end to end working.

The callback logic is handled by Spring Security directly (so you don’t need to)

What are you trying to do? Add custom logic in the callback?

My understanding is we need to implement “authorization-code/callback”

Do I have that wrong?

What I’m trying to do is implement the quickstart, and have it work end to end, but I always get a 400 error

Actually I’m not getting a 400 now, I’m getting a browser redirect to
http://localhost:8080/authorization-code/callback
along with a too many redirects error

Are you following this sample ?

1 Like

Correct, you don’t need to implement anything OAuth specific, its just configuration (same goes for if you use Spring Security directly)

OK I was able to get this working. The problem was I had

security.oauth2.sso.loginPath=http://localhost:8080/authorization-code/callback

instead of

security.oauth2.sso.loginPath=/authorization-code/callback

Makes sense because obviously okta can’t reach me on localhost.

No, I’m doing this one

https://developer.okta.com/quickstart/#/okta-sign-in-page/java/spring

One thing that I’m having trouble with is that I don’t want the entire webapp:

http:localhost:8080

behind the okta login

Just everthing under http:localhost:8080/protected/*

Is that possible?

I thought this would do it, but I get the okta redirect as soon as I hit localhost:8080

image