Next.jsexport const auth = betterAuth({
plugins: [
customSession(async ({ user, session }) => {
return {
user: {
...user,
externalUserId: null,
},
session,
};
}),
],
socialProviders: {
microsoft: {
// Deleted the basic stuff here
getUserInfo: async (token) => {
const response = await fetch("https://graph.microsoft.com/v1.0/me", {
headers: {
Authorization: Bearer ${token.accessToken},
},
});
const profile = await response.json();
return {
user: {
...user,
providerUserId: profile.id,
externalUserId: profile.id,
},
data: { ...profile, providerUserId: profile.id, externalUserId: profile.id },
};
},
},
}