Closed tiphaineruy closed 2 years ago
Yes, there is a pr on appauth js about logout. I was waiting for a merge from it. I will investigate next monday on it. If you have time, a pr would be very cool.
Thank you very much for your feeback.
This Pull Request merge would be nice => https://github.com/openid/AppAuth-JS/pull/198
Hi, I forked react-oidc and fitted it to a "merged" AppAuth (https://github.com/arssly/AppAuth-JS). Logout seems to work fine with react-oidc sample app.
Here is my feature branch : https://github.com/bonnetb/react-oidc/tree/feat/logout (not to be merged before https://github.com/openid/AppAuth-JS/pull/198 is merged)
Awesome @bonnetb thank you,
May you set a message on https://github.com/openid/AppAuth-JS/pull/198, it would be cool a merge from them :)
Do you have any news about this ?
I'm really concerned with and the lib AppAuth-JS sems to be off ...
Me too, may be we will need to implement it here.
Seems like AppAuth-JS hasn't been updated in a year. I wonder if it has become dead?
Yearh, I will try to email the team. I am thinking to take the owership of it and ask openid team to certify their own library.
For example: axa-fr/appauthjs
I'am waiting for any news from them => https://github.com/openid/AppAuth-JS/issues/209
If no news, I will fork it and ask openid team to certify the fork :/
I mean. For now its a 3 lines quick workaround:
oidc/vanilla/oidc.ts
async logoutAsync(callbackPath: string | undefined = undefined) {
const oidcServerConfiguration = await this.initAsync(this.configuration.authority);
// TODO implement real logout
---> const url = callbackPath || location.pathname + (location.search || '') + (location.hash || '');
await this.destroyAsync();
if (oidcServerConfiguration.endSessionEndpoint) {
window.location.href = ---> oidcServerConfiguration.endSessionEndpoint! + "?redirect_uri=" + encodeURI(url);
}
else {
window.location.reload();
}
}
and
oidc/ReactOidc.tsx
export const useOidc = (configurationName = defaultConfigurationName) => {
const getOidc = Oidc.get;
const login = (callbackPath: string | undefined = undefined, extras: StringMap = null) => {
return getOidc(configurationName).loginAsync(callbackPath, extras);
};
---> const logout = (callbackPath: string | undefined = undefined) => {
return getOidc(configurationName).logoutAsync(callbackPath);
};
let isAuthenticated: boolean = false;
const oidc = getOidc(configurationName);
if (oidc) {
isAuthenticated = getOidc(configurationName).tokens != null;
}
return { login, logout, isAuthenticated };
}
An then set the call back path when you "logout" in your app.
I made https://github.com/AxaGuilDEv/react-oidc/pull/761 But It does not seem to work with the identityServer demo.
Is there any solution for the Identity Server? To redirect on logout?
I will investigate
It is done by #775 . I close thie issue tahnk you again for it. Feel free to reopen it if needed.
Issue and Steps to Reproduce
logout doesn't expose a callback uri option:
Versions
4.2.3
Screenshots
Expected
Is there something else than appending the callbackPath to the logout endpoint that i'm missing ?
in oidc.ts line 434
Actual
Additional Details
I can open a PR for that If you want.