diff --git a/packages/frontendmu-nuxt/auth-utils/useAuth.ts b/packages/frontendmu-nuxt/auth-utils/useAuth.ts index 2f23313f..ff1070d6 100644 --- a/packages/frontendmu-nuxt/auth-utils/useAuth.ts +++ b/packages/frontendmu-nuxt/auth-utils/useAuth.ts @@ -114,6 +114,7 @@ export default function useAuth(client: DirectusClient & AuthenticationClie credentials: 'include', // this is required in order to send the refresh token cookie body: JSON.stringify({ refresh_token: getCookieValue('directus_session_token'), + mode: 'cookie', }), }, ) @@ -171,10 +172,12 @@ export default function useAuth(client: DirectusClient & AuthenticationClie 'meal', 'occupation', 'github_username', + 'external_identifier', 'Events.Events_id.id', 'Events.Events_id.title', 'profile_picture', 'role.name', + 'provider', ] try { @@ -220,9 +223,21 @@ export default function useAuth(client: DirectusClient & AuthenticationClie return false }) - function oAuthLogin() { - const currentPage = new URL(window.location.origin) - return `${DIRECTUS_URL()}/auth/login/google?redirect=${currentPage}redirect` + function oAuthLogin(provider: string) { + if (provider === 'google') { + const currentPage = new URL(window.location.origin) + return `${DIRECTUS_URL()}/auth/login/google?redirect=${currentPage}redirect` + } + else if (provider === 'github') { + const currentPage = new URL(window.location.origin) + return `${DIRECTUS_URL()}/auth/login/github?redirect=${currentPage}redirect` + } + else if (provider === 'discord') { + const currentPage = new URL(window.location.origin) + return `${DIRECTUS_URL()}/auth/login/discord?redirect=${currentPage}redirect` + } + + console.log('Provider not found') } async function updateUserProfile({ profile_updates }: { profile_updates: DirectusAstroUser }) { diff --git a/packages/frontendmu-nuxt/components/auth/LoggedUser.vue b/packages/frontendmu-nuxt/components/auth/LoggedUser.vue index aa8dbbb0..b8ec8fd5 100644 --- a/packages/frontendmu-nuxt/components/auth/LoggedUser.vue +++ b/packages/frontendmu-nuxt/components/auth/LoggedUser.vue @@ -1,103 +1,81 @@ diff --git a/packages/frontendmu-nuxt/components/auth/LoginWithGithub.vue b/packages/frontendmu-nuxt/components/auth/LoginWithGithub.vue new file mode 100644 index 00000000..f0886d3b --- /dev/null +++ b/packages/frontendmu-nuxt/components/auth/LoginWithGithub.vue @@ -0,0 +1,65 @@ + + + diff --git a/packages/frontendmu-nuxt/components/auth/MyProfile.vue b/packages/frontendmu-nuxt/components/auth/MyProfile.vue index aa620afc..84b6a9e5 100644 --- a/packages/frontendmu-nuxt/components/auth/MyProfile.vue +++ b/packages/frontendmu-nuxt/components/auth/MyProfile.vue @@ -100,18 +100,29 @@ function updateProfile() {
-
+
- +
@@ -119,13 +130,19 @@ function updateProfile() {
- +
@@ -134,15 +151,21 @@ function updateProfile() {
-