1

how's it going?

I have been studying angular 4/5 and Spring Boot and I'm trying to create a project to practice but I'm getting some problems.

I wanted to create an app where the user needs first to login (and here is the problem), but I still didn't understand how to do this communication between Angular and Spring (Spring + Thymeleaf worked easily for me).

I would like you guys to recommend me a good (I mean really good) tutorial to do so.

P.S: OAuth2 is very welcome also.

Thank you.

1 Answers1

1

Authentication on a production-ready single page app such as with Angular will be a little bit more complex than in your Thymeleaf counterpart. There are many ways to achieve this, but none of them will be as straightforward or without drawbacks out of the box. Have a look at this post to see some alternatives.

If you really need to get some code down, for the start you could take a look at how you might use HTTP basic auth for this (see this blog post) and JWT as it's extreme opposite (see this blog post). It should be a start to get your head around authentication on a single page app and you can successively educate yourself to go further from there.

Because you primarily seem to be focused on experimenting with Angular and Spring Boot, rather than with authentication mechanisms, I recommend you going with HTTP basic auth.

AlexLiesenfeld
  • 2,872
  • 7
  • 36
  • 57