oauth session refresh issue
it looks like oauth is working now for connecting a did space!
i have to refresh after i connect to spaces for the first time. is it possible after the user connects to spaces to refresh the session context?
here is the applicable code:
import { createAuthServiceSessionContext } from '@arcblock/did-connect/lib/Session';
import { useContext } from 'react';
const { SessionProvider, SessionContext, SessionConsumer, withSession } = createAuthServiceSessionContext();
function useSessionContext() {
const info = useContext(SessionContext);
return info as any;
}
export { SessionProvider, SessionContext, SessionConsumer, useSessionContext, withSession };
const { session } = useSessionContext();
useEffect(() => {
console.log(logged in, session);
}, [session]);
this session useEffect gets called when they login but not after they connect their did space.
7 条回复
Great suggestions, we will publish an improved version of
@arcblock/did-connectthis week, please stay tuned.By the way, you can wrap code in your post in an code block for better readability, 😄
You can trigger that by using "/" command, or using the editor toolbar.
sounds great! can't wait.
thanks!
z1e4XATJSo1Y1jom17Uhj1SpKZ4LFmYSaHY
This feature is now supported, subscribe to DID Space events. Currently, all OAuth accounts will trigger this event when DID Space is successfully presented. Please update versions of @arcblock/ux and @arcblock/did-connect to 2.11.19 and above. For code examples, please refer to(subscribe EVENTS.DID_SPACE_CONNECTED event): Subscribe to DID Connect Events
thank you! i'll update and try it out. can't wait!
once i updated those two packages, i received these errors:
Hi, please upgrade following packages to latest to resolve this issue:
thank you!
everything works as expected now!!
i login using my gmail, then connect did spaces using gmail for the first time, then our blocklet can write to the users did space.