Laravel-based OAuth/IAM service with Passport, Vue 3 frontend, and Docker Compose setup for local and production deployment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
68 lines
2.0 KiB
Vue
68 lines
2.0 KiB
Vue
<script setup lang="ts">
|
|
import { onMounted, ref } from 'vue';
|
|
import axios from 'axios';
|
|
import { useI18n } from 'vue-i18n';
|
|
import type { AuthorizedAppToken } from '../types/models';
|
|
|
|
const { t } = useI18n();
|
|
|
|
const tokens = ref<AuthorizedAppToken[]>([]);
|
|
const loading = ref(true);
|
|
|
|
async function load(): Promise<void> {
|
|
loading.value = true;
|
|
const { data } = await axios.get<AuthorizedAppToken[]>('/web-api/authorized-apps');
|
|
tokens.value = data;
|
|
loading.value = false;
|
|
}
|
|
|
|
async function revoke(token: AuthorizedAppToken): Promise<void> {
|
|
if (!confirm(t('authorizedApps.revokeConfirm', { name: token.client.name }))) return;
|
|
|
|
await axios.delete(`/web-api/authorized-apps/${token.id}`);
|
|
await load();
|
|
}
|
|
|
|
onMounted(load);
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<h1 class="page-title">{{ t('authorizedApps.title') }}</h1>
|
|
<p class="page-subtitle">{{ t('authorizedApps.subtitle') }}</p>
|
|
|
|
<div class="authorized-apps__list">
|
|
<p v-if="loading" class="page-subtitle">{{ t('common.loading') }}</p>
|
|
<p v-else-if="!tokens.length" class="page-subtitle">{{ t('authorizedApps.empty') }}</p>
|
|
|
|
<div v-for="token in tokens" :key="token.id" class="card authorized-apps__item">
|
|
<div>
|
|
<p class="card__title">{{ token.client.name }}</p>
|
|
<p class="authorized-apps__item-meta">{{ t('authorizedApps.scopesLabel') }}: {{ token.scopes?.join(', ') || t('common.none') }}</p>
|
|
</div>
|
|
<button @click="revoke(token)" class="link link--danger">{{ t('authorizedApps.revoke') }}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.authorized-apps__list {
|
|
margin-top: 1.5rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.authorized-apps__item {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.authorized-apps__item-meta {
|
|
font-size: 0.75rem;
|
|
color: var(--color-text-muted);
|
|
}
|
|
</style>
|