Web Developer
This is my auth handler.
const createState = () => { const { subscribe, set, update } = writable<State>({ account: null, })
return { subscribe, signUp: async (email: string, password: string, name: string) => { return await sdk.account.create('unique()', email, password, name) }, signIn: async (email: string, password: string) => { await sdk.account.createEmailSession(email, password) const user = await sdk.account.get() state.init(user) }, signOut: async () => { state.init(null) await sdk.account.deleteSession('current') }, init: async (account: Models.User<Models.Preferences> | null = null) => { return set({ account }) }, oAuth: async (provider: string, redirectURL: string) => { sdk.account.createOAuth2Session(provider, redirectURL) const user = await sdk.account.get() state.init(user) } }}This is my GitHub button.
<IconButton on:click={() => state.oAuth('github', `https://${data.hostname}`)}></IconButton>When I click on the button, the redirect works and the page refreshes, but the app state does not change. I don't know how to get the user's details after OAuth2. Do I have to make a request to the GitHub API?