Fetch user after successful sign in
This commit is contained in:
parent
59ac499c3b
commit
eaa8a0b8ed
1 changed files with 3 additions and 11 deletions
|
|
@ -151,21 +151,13 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
|||
if (credential.identityToken) {
|
||||
const {
|
||||
error,
|
||||
data: { user, session },
|
||||
data: { session },
|
||||
} = await supabase.auth.signInWithIdToken({
|
||||
provider: "apple",
|
||||
token: credential.identityToken,
|
||||
});
|
||||
if (!error && user) {
|
||||
const userProfile = {
|
||||
id: user.id,
|
||||
email: user.email ?? "",
|
||||
name: user.user_metadata.name,
|
||||
avatar_url: user.user_metadata.picture,
|
||||
streamToken: user.user_metadata.streamToken,
|
||||
};
|
||||
|
||||
await set({ user: userProfile, session });
|
||||
if (!error && session) {
|
||||
await set({ session });
|
||||
}
|
||||
} else {
|
||||
throw new Error("No identityToken.");
|
||||
|
|
|
|||
Loading…
Reference in a new issue