Vue oauth2 redirect with spring boot

Hi,

We are building a vue front end with springboot microservices in the back.
I used the sample from okta to add oauth2 to my vue front end via the vue sdk.

I was looking to run the vue app as static content in spring, but the auth redirect fails with vue sdk auth. I tried to change it to localhost:8080/login but that also failed
I am currently looking to keep vue auth as I have static pages currently that is secured (although at this point it is still a get used to have things should be done app)

the auth work well when running: npm run dev

is it better to run the vue gui separately?
we will be deploying to AWS and potentially I can look to run things in docker as well if deploying to other cloud platforms

thanks for the advice or pointing out how the redirect for vue inside spring boot should be setup.

What sample are you using specifically? You basically have two options:

  1. Deploy your apps separately: configure Spring Boot as a resource server and use the Okta Vue SDK for the client.
  2. Package and deploy your apps together. In this case, using the Okta Vue SDK won’t work.

The frontend-maven-plugin makes #2 possible if you’re using Maven. There’s an example of how to make the client know if a user is logged in or not in my Use React and Spring Boot to Build a Simple CRUD App blog post.

Hi mraible,

thanks for clarifying when the okta sdk will work for auth. Also thanks for the example projects you guys spend time to post. an immense help to get going.

I originally started with some blogger showing how to merge vue and springboot before looking at oauth2 setups.
so used your samples to add the oauth2 in for for vue. it works nicely when running npm but thought I could get it to work in spring boot.

I will have a look at your react project and see if I can get it working, else will deploy it separately and save myself the time for now.

regards