@frigear-nu/oauth-server 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { isNativeRedirectUri } from "../../utils";
|
|
2
3
|
import { oauthServerApi, oidc } from "../../utils/api";
|
|
3
4
|
import { $fetch, navigateTo, ref, useAuthPages, useErrorToast, useFetch, useModuleT, useRoute } from "#imports";
|
|
4
5
|
defineOptions({ name: "OAuthAuthorizePage" });
|
|
@@ -22,6 +23,7 @@ const scopeLabel = (scope) => {
|
|
|
22
23
|
return known[scope] ?? scope;
|
|
23
24
|
};
|
|
24
25
|
const pending = ref(null);
|
|
26
|
+
const appRedirectUrl = ref(null);
|
|
25
27
|
async function decide(approved) {
|
|
26
28
|
pending.value = approved ? "approve" : "deny";
|
|
27
29
|
try {
|
|
@@ -29,6 +31,12 @@ async function decide(approved) {
|
|
|
29
31
|
method: "POST",
|
|
30
32
|
body: { ...route.query, approved }
|
|
31
33
|
});
|
|
34
|
+
if (isNativeRedirectUri(redirectUrl)) {
|
|
35
|
+
appRedirectUrl.value = redirectUrl;
|
|
36
|
+
pending.value = null;
|
|
37
|
+
window.location.href = redirectUrl;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
32
40
|
await navigateTo(redirectUrl, { external: true });
|
|
33
41
|
} catch (err) {
|
|
34
42
|
showError(err, t("authorize.failed", "Could not complete the sign-in. Please try again."));
|
|
@@ -39,7 +47,22 @@ async function decide(approved) {
|
|
|
39
47
|
|
|
40
48
|
<template>
|
|
41
49
|
<AuthCard
|
|
42
|
-
v-if="consent"
|
|
50
|
+
v-if="consent && appRedirectUrl"
|
|
51
|
+
:title="t('authorize.returnTitle', 'Return to {name}', { name: consent.application.name })"
|
|
52
|
+
:description="t('authorize.returnHint', 'If the app did not open, tap the button below. You can close this window afterwards.')"
|
|
53
|
+
>
|
|
54
|
+
<UButton
|
|
55
|
+
:to="appRedirectUrl"
|
|
56
|
+
external
|
|
57
|
+
block
|
|
58
|
+
size="lg"
|
|
59
|
+
icon="i-lucide-external-link"
|
|
60
|
+
:label="t('authorize.returnToApp', 'Return to the app')"
|
|
61
|
+
/>
|
|
62
|
+
</AuthCard>
|
|
63
|
+
|
|
64
|
+
<AuthCard
|
|
65
|
+
v-else-if="consent"
|
|
43
66
|
:title="t('authorize.title', 'Sign in to {name}', { name: consent.application.name })"
|
|
44
67
|
>
|
|
45
68
|
<template #description>
|
|
@@ -109,6 +109,9 @@
|
|
|
109
109
|
"invalidTitle": "Denne loginanmodning kan ikke gennemføres",
|
|
110
110
|
"invalidDescription": "Anmodningen er ugyldig.",
|
|
111
111
|
"failed": "Login kunne ikke gennemføres. Prøv igen.",
|
|
112
|
+
"returnTitle": "Vend tilbage til {name}",
|
|
113
|
+
"returnToApp": "Vend tilbage til appen",
|
|
114
|
+
"returnHint": "Hvis appen ikke åbnede, så tryk på knappen nedenfor. Du kan lukke dette vindue bagefter.",
|
|
112
115
|
"scope": {
|
|
113
116
|
"openid": "Bekræfte din identitet",
|
|
114
117
|
"profile": "Dit navn og profilbillede",
|
|
@@ -109,6 +109,9 @@
|
|
|
109
109
|
"invalidTitle": "This sign-in request cannot be completed",
|
|
110
110
|
"invalidDescription": "The request is invalid.",
|
|
111
111
|
"failed": "Could not complete the sign-in. Please try again.",
|
|
112
|
+
"returnTitle": "Return to {name}",
|
|
113
|
+
"returnToApp": "Return to the app",
|
|
114
|
+
"returnHint": "If the app did not open, tap the button below. You can close this window afterwards.",
|
|
112
115
|
"scope": {
|
|
113
116
|
"openid": "Verify your identity",
|
|
114
117
|
"profile": "Your name and profile picture",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frigear-nu/oauth-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "OAuth 2.0 / OpenID Connect server for the frigear ecosystem: register applications that users with certain roles may sign in to.",
|
|
5
5
|
"url": "https://docs.frigear.dev/modules/oauth-server",
|
|
6
6
|
"author": {
|