How to realize OAuth2 authentication in Angular

2019-08-26 23:44发布

问题:

i have a Spring-rest api with full OAuth2 authentication in it. Now i want to implement a front end for the api with Angular2. This is my first Angular2 app and my first front end app. I feel like i have searched the whole internet on how to do this, and found some tutorials but when i tried to apply it in my angular app it always went something wrong. So i've decided to do it on my own. I have already some services which can send http request and get a response for example to get a user from my server (without authentication) and so i created a guard for the endpoint and a service. When i request a token, my angular app doesn't send a request to the server. You can read my issue and how i implemented it here .

Can you give me an advice on how to realize this task? Thanks for the help!