Angular / Typescript oauth2 login authorization – redirect url

  Kiến thức lập trình

We have an application typed in Angular for frontend and Scala for backend. We are implementing oauth2 authorization so people can login with Google account.

Backend created an endpoint which returns redirect url, so:

let’s say endpoint

returns a string with url to where user is forwarded to

user accepts all agreements and is forwarded to site which is stored in the url mentioned earlier – in redirecturi param

that site is actually a http request, lets say:

which return id, accessToken, refreshToken that I need to use

the problem is that i dont know how to catch that data, I can see it on the screen, but i have no idea what to do to use it

user is redirected to that endpoint like to a normal site

everything is done in backend, I just get the redirect url, and then need to assign the tokens returned also from backend
the endpoint

also contains params generated in backend

for now lets say that no changes can be done to backend
my code would look like this:

authorizationService.getRedirectUrl().subscribe((url) => {
    window.location.href = url

I dont know how to even start with it, cant use token endpoint somewhere else because its generated through APItext