You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a project created by Vite, which is reactjs with typescript, it works, but the refreshToken is not working, could you help me, when I try to add refresh I get a lot of errors.
I tried implementing onSigninCallback in oidcConfig.ts on onSigninCallback , as requested here, `You must provide an implementation of onSigninCallback to oidcConfig to remove the payload from the URL upon successful login. Otherwise if you refresh the page and the payload is still there, signinSilent - which handles renewing your token - won't work.
When setting automaticSilentRenew: true, the underlying library oidc-client-ts takes care of the renew process, it triggers it and this library will handle the callback.
So either you handle it your own or not...
useEffect(() => {
// the `return` is important - addAccessTokenExpiring() returns a cleanup function
return auth.events.addAccessTokenExpiring(() => {
auth.signinSilent();
})
}, [auth.events, auth.signinSilent]);
@pamapa
Following the first option, adding automaticSilentRenew: true, is it necessary to pass any more data such as: Silent_redirect_uri? If so, what would need to be added? Could you explain more clearly?
consider that my oidcConfig is like this.
import { WebStorageStateStore, User } from 'oidc-client-ts';
export const oidcConfig = {
authority: ENV.AUTHORIT,
client_id: ENV.CLIENT_ID,
redirect_uri: "http://localhost:4200/",
post_logout_redirect_uri: "http://localhost:4200",
response_type: "code",
prompt: 'login', // Faz o login sempre acontecer novamente
scope: "openid robot_signalr_api feeder_subscriber",
automaticSilentRenew: true,
//silent_redirect_uri: "http://localhost:4200/silent-renew",
systemOrigem: 'AAI',
userStore: new WebStorageStateStore({ store: window.localStorage }), // Adicione esta linha
onSigninCallback: async (user: User) => {
if (user) {
window.history.replaceState({}, document.title, window.location.pathname);
}
},
If necessary, please explain what needs to be changed.
I have a project created by Vite, which is reactjs with typescript, it works, but the refreshToken is not working, could you help me, when I try to add refresh I get a lot of errors.
Here is the project link, if you get an answer, describe it here or make a pull request
https://github.com/JoezerSmaniotto/IdentityServerIs
My project looks like this:
oidcConfig.ts
App.tsx
Routes.tsx
ProtectedRoute.tsx
Login.tsx
PrivatePage.tsx
I tried implementing onSigninCallback in oidcConfig.ts on onSigninCallback , as requested here, `You must provide an implementation of onSigninCallback to oidcConfig to remove the payload from the URL upon successful login. Otherwise if you refresh the page and the payload is still there, signinSilent - which handles renewing your token - won't work.
A working implementation is already in the code here.`
https://www.npmjs.com/package/react-oidc-context?activeTab=readme
But there is an error in main.tsx
Could you help me refresh Token and implement onSigninCallback ?
The text was updated successfully, but these errors were encountered: