I am trying to logout with Spartacus Auth0. I have used "OAuthLibWrapperService" and logout method. Where it is clearing access token only. Can I know how can I redirect to Auth0 login screen on logout button click. Also tried with "OAuthService" and logout method clearing only access token not able to redirect to Auth0. Tried with "OAuthService" and revokeTokenAndLogout method In network tab logout API shows CORS error. Any help on this please to fix logout?
Asked
Active
Viewed 311 times
0
-
I don't fully get the question. Are you unable to extend AuthService methods to do something extra (redirect) after revoking tokens? If so, how do you extend those services? – Marcin Lasak Jul 29 '21 at 05:22
-
Thanks @MarcinLasak for reply. I am trying to logout with OAuth with service of "OAuthLibWrapperService" with logout() method. It is just clearing local storage but it is not redirecting to login screen. Can you please help on click on logout to redirect to login screen – Ajay.k Jul 30 '21 at 06:50
-
If you want to login and redirect I would recommend using `logout` method from `AuthService`. It redirects to logout page. That kicks LogoutGuard which invokes logout and redirects to hompage or login (if it's protected store). Alternatively you can use `coreLogout` from `AuthService` and once this method resolves manually redirect to login page. – Marcin Lasak Aug 02 '21 at 10:34
-
It mean to use import { AuthService } from '@auth0/auth0-angular'; for logout? – Ajay.k Aug 02 '21 at 13:23
-
AuthService from @spartacus/core – Marcin Lasak Aug 03 '21 at 18:31
-
Thanks Marcin. It is working. But small confirmation https://DomainName/v2/logout is still giving CORS error even It was allowed origin in AUTH0. Is that expected? Or is there any fix for that? Application wise I am able to logout. – Ajay.k Aug 04 '21 at 09:10
-
I can't answer that as I don't have much experience in Auth0 – Marcin Lasak Aug 05 '21 at 08:46
1 Answers
0
corsfilter.oauth2.allowedHeaders=origin content-type accept authorization Check if this property is present or not

kritika narang
- 41
- 3