'How to get state and client_id from OauthService - Angular

I have an app in Angular, which using OAuthService. I need to create logout url with redirect, assign it to variable redirect_url, and execute this code in my component:

window.location.href = this.redirect_url

Url (before encode) looks like:

https://example-app.com/logout?service=https://example-app.com/oauth2.0/authorize?response_type=token&client_id=xxxxxx&state=yyyyyy&redirect_uri=https://example-app.com/someComponent?code=123&scope=read

I don't know how to get state and redirect_uri.

I looked at the auth service code in the angular-oauth2-oidc.umd.js file and found that state is generated in the TryLogin() method. I also see that the login url is being created in the cleateLoginUrl() method. I don't know how I can get state and client_id to pass this to the newly created url. Is there any method on this site that I can use?

Case: logout user, show the login window with url redirection. After login, the user will be redirected to redirect_uri.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source