nuxt-auth-utils 0.2.1 → 0.3.0
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/README.md +40 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/dist/runtime/server/lib/oauth/auth0.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/auth0.js +1 -1
- package/dist/runtime/server/lib/oauth/battledotnet.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/battledotnet.js +1 -1
- package/dist/runtime/server/lib/oauth/cognito.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/cognito.js +1 -1
- package/dist/runtime/server/lib/oauth/discord.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/discord.js +1 -1
- package/dist/runtime/server/lib/oauth/facebook.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/facebook.js +1 -1
- package/dist/runtime/server/lib/oauth/github.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/github.js +1 -1
- package/dist/runtime/server/lib/oauth/google.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/google.js +1 -1
- package/dist/runtime/server/lib/oauth/keycloak.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/keycloak.js +1 -1
- package/dist/runtime/server/lib/oauth/linkedin.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/linkedin.js +1 -1
- package/dist/runtime/server/lib/oauth/microsoft.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/microsoft.js +1 -1
- package/dist/runtime/server/lib/oauth/paypal.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/paypal.js +1 -1
- package/dist/runtime/server/lib/oauth/spotify.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/spotify.js +1 -1
- package/dist/runtime/server/lib/oauth/steam.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/steam.js +1 -1
- package/dist/runtime/server/lib/oauth/twitch.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/twitch.js +1 -1
- package/dist/runtime/server/lib/oauth/x.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/x.js +1 -1
- package/dist/runtime/server/lib/oauth/xsuaa.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/xsuaa.js +1 -1
- package/dist/runtime/server/lib/oauth/yandex.d.ts +1 -1
- package/dist/runtime/server/lib/oauth/yandex.js +1 -1
- package/package.json +1 -1
- package/dist/runtime/server/utils/oauth.d.ts +0 -36
- package/dist/runtime/server/utils/oauth.js +0 -36
package/README.md
CHANGED
|
@@ -21,6 +21,8 @@ Add Authentication to Nuxt applications with secured & sealed cookies sessions.
|
|
|
21
21
|
- [`<AuthState>` component](#authstate-component)
|
|
22
22
|
- [Extendable with hooks](#extend-session)
|
|
23
23
|
|
|
24
|
+
It has few dependencies (only from [UnJS](https://github.com/unjs)), run on multiple JS environments (Node, Deno, Workers) and is fully typed with TypeScript.
|
|
25
|
+
|
|
24
26
|
## Requirements
|
|
25
27
|
|
|
26
28
|
This module only works with a Nuxt server running as it uses server API routes (`nuxt build`).
|
|
@@ -56,7 +58,7 @@ Nuxt Auth Utils automatically adds some plugins to fetch the current user sessio
|
|
|
56
58
|
|
|
57
59
|
```vue
|
|
58
60
|
<script setup>
|
|
59
|
-
const { loggedIn, user, session, clear } = useUserSession()
|
|
61
|
+
const { loggedIn, user, session, fetch, clear } = useUserSession()
|
|
60
62
|
</script>
|
|
61
63
|
|
|
62
64
|
<template>
|
|
@@ -72,6 +74,37 @@ const { loggedIn, user, session, clear } = useUserSession()
|
|
|
72
74
|
</template>
|
|
73
75
|
```
|
|
74
76
|
|
|
77
|
+
**TypeScript Signature:**
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
interface UserSessionComposable {
|
|
81
|
+
/**
|
|
82
|
+
* Computed indicating if the auth session is ready
|
|
83
|
+
*/
|
|
84
|
+
ready: ComputedRef<boolean>
|
|
85
|
+
/**
|
|
86
|
+
* Computed indicating if the user is logged in.
|
|
87
|
+
*/
|
|
88
|
+
loggedIn: ComputedRef<boolean>
|
|
89
|
+
/**
|
|
90
|
+
* The user object if logged in, null otherwise.
|
|
91
|
+
*/
|
|
92
|
+
user: ComputedRef<User | null>
|
|
93
|
+
/**
|
|
94
|
+
* The session object.
|
|
95
|
+
*/
|
|
96
|
+
session: Ref<UserSession>
|
|
97
|
+
/**
|
|
98
|
+
* Fetch the user session from the server.
|
|
99
|
+
*/
|
|
100
|
+
fetch: () => Promise<void>
|
|
101
|
+
/**
|
|
102
|
+
* Clear the user session and remove the session cookie.
|
|
103
|
+
*/
|
|
104
|
+
clear: () => Promise<void>
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
75
108
|
## Server Utils
|
|
76
109
|
|
|
77
110
|
The following helpers are auto-imported in your `server/` directory.
|
|
@@ -122,9 +155,9 @@ export {}
|
|
|
122
155
|
|
|
123
156
|
### OAuth Event Handlers
|
|
124
157
|
|
|
125
|
-
All
|
|
158
|
+
All handlers can be auto-imported and used in your server routes or API routes.
|
|
126
159
|
|
|
127
|
-
The pattern is `oauth
|
|
160
|
+
The pattern is `oauth<Provider>EventHandler({ onSuccess, config?, onError? })`, example: `authGitHubEventHandler`.
|
|
128
161
|
|
|
129
162
|
The helper returns an event handler that automatically redirects to the provider authorization page and then calls `onSuccess` or `onError` depending on the result.
|
|
130
163
|
|
|
@@ -134,6 +167,7 @@ The `config` can be defined directly from the `runtimeConfig` in your `nuxt.conf
|
|
|
134
167
|
export default defineNuxtConfig({
|
|
135
168
|
runtimeConfig: {
|
|
136
169
|
oauth: {
|
|
170
|
+
// provider in lowercase (github, google, etc.)
|
|
137
171
|
<provider>: {
|
|
138
172
|
clientId: '...',
|
|
139
173
|
clientSecret: '...'
|
|
@@ -148,6 +182,8 @@ It can also be set using environment variables:
|
|
|
148
182
|
- `NUXT_OAUTH_<PROVIDER>_CLIENT_ID`
|
|
149
183
|
- `NUXT_OAUTH_<PROVIDER>_CLIENT_SECRET`
|
|
150
184
|
|
|
185
|
+
> Provider is in uppercase (GITHUB, GOOGLE, etc.)
|
|
186
|
+
|
|
151
187
|
#### Supported OAuth Providers
|
|
152
188
|
|
|
153
189
|
- Auth0
|
|
@@ -175,7 +211,7 @@ You can add your favorite provider by creating a new file in [src/runtime/server
|
|
|
175
211
|
Example: `~/server/routes/auth/github.get.ts`
|
|
176
212
|
|
|
177
213
|
```ts
|
|
178
|
-
export default
|
|
214
|
+
export default oauthGitHubEventHandler({
|
|
179
215
|
config: {
|
|
180
216
|
emailRequired: true
|
|
181
217
|
},
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -19,6 +19,7 @@ const module = defineNuxtModule({
|
|
|
19
19
|
addPlugin(resolver.resolve("./runtime/app/plugins/session.server"));
|
|
20
20
|
addPlugin(resolver.resolve("./runtime/app/plugins/session.client"));
|
|
21
21
|
addServerPlugin(resolver.resolve("./runtime/server/plugins/oauth"));
|
|
22
|
+
addServerImportsDir(resolver.resolve("./runtime/server/lib/oauth"));
|
|
22
23
|
addServerImportsDir(resolver.resolve("./runtime/server/utils"));
|
|
23
24
|
addServerHandler({
|
|
24
25
|
handler: resolver.resolve("./runtime/server/api/session.delete"),
|
|
@@ -52,4 +52,4 @@ export interface OAuthAuth0Config {
|
|
|
52
52
|
*/
|
|
53
53
|
authorizationParams?: Record<string, string>;
|
|
54
54
|
}
|
|
55
|
-
export declare function
|
|
55
|
+
export declare function oauthAuth0EventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthAuth0Config>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
2
2
|
import { withQuery, parsePath } from "ufo";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export function
|
|
5
|
+
export function oauthAuth0EventHandler({ config, onSuccess, onError }) {
|
|
6
6
|
return eventHandler(async (event) => {
|
|
7
7
|
config = defu(config, useRuntimeConfig(event).oauth?.auth0, {
|
|
8
8
|
authorizationParams: {}
|
|
@@ -40,4 +40,4 @@ export interface OAuthBattledotnetConfig {
|
|
|
40
40
|
*/
|
|
41
41
|
authorizationParams?: Record<string, string>;
|
|
42
42
|
}
|
|
43
|
-
export declare function
|
|
43
|
+
export declare function oauthBattledotnetEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthBattledotnetConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -3,7 +3,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
3
3
|
import { withQuery, parsePath } from "ufo";
|
|
4
4
|
import { defu } from "defu";
|
|
5
5
|
import { useRuntimeConfig } from "#imports";
|
|
6
|
-
export function
|
|
6
|
+
export function oauthBattledotnetEventHandler({ config, onSuccess, onError }) {
|
|
7
7
|
return eventHandler(async (event) => {
|
|
8
8
|
config = defu(config, useRuntimeConfig(event).oauth?.battledotnet, {
|
|
9
9
|
authorizationURL: "https://oauth.battle.net/authorize",
|
|
@@ -31,4 +31,4 @@ export interface OAuthCognitoConfig {
|
|
|
31
31
|
*/
|
|
32
32
|
authorizationParams?: Record<string, string>;
|
|
33
33
|
}
|
|
34
|
-
export declare function
|
|
34
|
+
export declare function oauthCognitoEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthCognitoConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
2
2
|
import { withQuery, parsePath } from "ufo";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export function
|
|
5
|
+
export function oauthCognitoEventHandler({ config, onSuccess, onError }) {
|
|
6
6
|
return eventHandler(async (event) => {
|
|
7
7
|
config = defu(config, useRuntimeConfig(event).oauth?.cognito, {
|
|
8
8
|
authorizationParams: {}
|
|
@@ -45,4 +45,4 @@ export interface OAuthDiscordConfig {
|
|
|
45
45
|
*/
|
|
46
46
|
authorizationParams?: Record<string, string>;
|
|
47
47
|
}
|
|
48
|
-
export declare function
|
|
48
|
+
export declare function oauthDiscordEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthDiscordConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
2
2
|
import { withQuery, parseURL, stringifyParsedURL } from "ufo";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export function
|
|
5
|
+
export function oauthDiscordEventHandler({ config, onSuccess, onError }) {
|
|
6
6
|
return eventHandler(async (event) => {
|
|
7
7
|
config = defu(config, useRuntimeConfig(event).oauth?.discord, {
|
|
8
8
|
authorizationURL: "https://discord.com/oauth2/authorize",
|
|
@@ -40,4 +40,4 @@ export interface OAuthFacebookConfig {
|
|
|
40
40
|
*/
|
|
41
41
|
authorizationParams?: Record<string, string>;
|
|
42
42
|
}
|
|
43
|
-
export declare function
|
|
43
|
+
export declare function oauthFacebookEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthFacebookConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -39,4 +39,4 @@ export interface OAuthGitHubConfig {
|
|
|
39
39
|
*/
|
|
40
40
|
authorizationParams?: Record<string, string>;
|
|
41
41
|
}
|
|
42
|
-
export declare function
|
|
42
|
+
export declare function oauthGitHubEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthGitHubConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
2
2
|
import { withQuery } from "ufo";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export function
|
|
5
|
+
export function oauthGitHubEventHandler({ config, onSuccess, onError }) {
|
|
6
6
|
return eventHandler(async (event) => {
|
|
7
7
|
config = defu(config, useRuntimeConfig(event).oauth?.github, {
|
|
8
8
|
authorizationURL: "https://github.com/login/oauth/authorize",
|
|
@@ -39,4 +39,4 @@ export interface OAuthGoogleConfig {
|
|
|
39
39
|
*/
|
|
40
40
|
authorizationParams?: Record<string, string>;
|
|
41
41
|
}
|
|
42
|
-
export declare function
|
|
42
|
+
export declare function oauthGoogleEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthGoogleConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -33,4 +33,4 @@ export interface OAuthKeycloakConfig {
|
|
|
33
33
|
*/
|
|
34
34
|
authorizationParams?: Record<string, string>;
|
|
35
35
|
}
|
|
36
|
-
export declare function
|
|
36
|
+
export declare function oauthKeycloakEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthKeycloakConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -45,5 +45,5 @@ interface OAuthConfig {
|
|
|
45
45
|
}) => Promise<void> | void;
|
|
46
46
|
onError?: (event: H3Event, error: H3Error) => Promise<void> | void;
|
|
47
47
|
}
|
|
48
|
-
export declare function
|
|
48
|
+
export declare function oauthLinkedInEventHandler({ config, onSuccess, onError }: OAuthConfig): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
49
49
|
export {};
|
|
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
2
2
|
import { withQuery, parseURL, stringifyParsedURL } from "ufo";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export function
|
|
5
|
+
export function oauthLinkedInEventHandler({ config, onSuccess, onError }) {
|
|
6
6
|
return eventHandler(async (event) => {
|
|
7
7
|
config = defu(config, useRuntimeConfig(event).oauth?.linkedin, {
|
|
8
8
|
authorizationURL: "https://www.linkedin.com/oauth/v2/authorization",
|
|
@@ -59,5 +59,5 @@ interface OAuthConfig {
|
|
|
59
59
|
}) => Promise<void> | void;
|
|
60
60
|
onError?: (event: H3Event, error: H3Error) => Promise<void> | void;
|
|
61
61
|
}
|
|
62
|
-
export declare function
|
|
62
|
+
export declare function oauthMicrosoftEventHandler({ config, onSuccess, onError }: OAuthConfig): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
63
63
|
export {};
|
|
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
2
2
|
import { withQuery, parsePath } from "ufo";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export function
|
|
5
|
+
export function oauthMicrosoftEventHandler({ config, onSuccess, onError }) {
|
|
6
6
|
return eventHandler(async (event) => {
|
|
7
7
|
config = defu(config, useRuntimeConfig(event).oauth?.microsoft, {
|
|
8
8
|
authorizationParams: {}
|
|
@@ -44,4 +44,4 @@ export interface OAuthPaypalConfig {
|
|
|
44
44
|
*/
|
|
45
45
|
authorizationParams?: Record<string, string>;
|
|
46
46
|
}
|
|
47
|
-
export declare function
|
|
47
|
+
export declare function oauthPaypalEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthPaypalConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
2
2
|
import { withQuery, parsePath } from "ufo";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export function
|
|
5
|
+
export function oauthPaypalEventHandler({ config, onSuccess, onError }) {
|
|
6
6
|
return eventHandler(async (event) => {
|
|
7
7
|
config = defu(config, useRuntimeConfig(event).oauth?.paypal, {
|
|
8
8
|
sandbox: import.meta.dev,
|
|
@@ -39,4 +39,4 @@ export interface OAuthSpotifyConfig {
|
|
|
39
39
|
*/
|
|
40
40
|
authorizationParams?: Record<string, string>;
|
|
41
41
|
}
|
|
42
|
-
export declare function
|
|
42
|
+
export declare function oauthSpotifyEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthSpotifyConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
2
2
|
import { withQuery, parsePath } from "ufo";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export function
|
|
5
|
+
export function oauthSpotifyEventHandler({ config, onSuccess, onError }) {
|
|
6
6
|
return eventHandler(async (event) => {
|
|
7
7
|
config = defu(config, useRuntimeConfig(event).oauth?.spotify, {
|
|
8
8
|
authorizationURL: "https://accounts.spotify.com/authorize",
|
|
@@ -12,4 +12,4 @@ export interface OAuthSteamConfig {
|
|
|
12
12
|
*/
|
|
13
13
|
authorizationURL?: string;
|
|
14
14
|
}
|
|
15
|
-
export declare function
|
|
15
|
+
export declare function oauthSteamEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthSteamConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
2
2
|
import { withQuery } from "ufo";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export function
|
|
5
|
+
export function oauthSteamEventHandler({ config, onSuccess, onError }) {
|
|
6
6
|
return eventHandler(async (event) => {
|
|
7
7
|
config = defu(config, useRuntimeConfig(event).oauth?.steam, {
|
|
8
8
|
authorizationURL: "https://steamcommunity.com/openid/login"
|
|
@@ -39,4 +39,4 @@ export interface OAuthTwitchConfig {
|
|
|
39
39
|
*/
|
|
40
40
|
authorizationParams?: Record<string, string>;
|
|
41
41
|
}
|
|
42
|
-
export declare function
|
|
42
|
+
export declare function oauthTwitchEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthTwitchConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
2
2
|
import { withQuery, parsePath } from "ufo";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export function
|
|
5
|
+
export function oauthTwitchEventHandler({ config, onSuccess, onError }) {
|
|
6
6
|
return eventHandler(async (event) => {
|
|
7
7
|
config = defu(config, useRuntimeConfig(event).oauth?.twitch, {
|
|
8
8
|
authorizationURL: "https://id.twitch.tv/oauth2/authorize",
|
|
@@ -43,4 +43,4 @@ export interface OAuthXConfig {
|
|
|
43
43
|
*/
|
|
44
44
|
authorizationParams: Record<string, string>;
|
|
45
45
|
}
|
|
46
|
-
export declare function
|
|
46
|
+
export declare function oauthXEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthXConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -23,4 +23,4 @@ export interface OAuthXSUAAConfig {
|
|
|
23
23
|
*/
|
|
24
24
|
scope?: string[];
|
|
25
25
|
}
|
|
26
|
-
export declare function
|
|
26
|
+
export declare function oauthXSUAAEventHandler({ config, onSuccess, onError }: OAuthConfig<OAuthXSUAAConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -2,7 +2,7 @@ import { eventHandler, createError, getQuery, getRequestURL, sendRedirect } from
|
|
|
2
2
|
import { withQuery, parsePath } from "ufo";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
|
-
export function
|
|
5
|
+
export function oauthXSUAAEventHandler({ config, onSuccess, onError }) {
|
|
6
6
|
return eventHandler(async (event) => {
|
|
7
7
|
config = defu(config, useRuntimeConfig(event).oauth?.xsuaa);
|
|
8
8
|
const { code } = getQuery(event);
|
|
@@ -38,4 +38,4 @@ export interface OAuthYandexConfig {
|
|
|
38
38
|
*/
|
|
39
39
|
userURL?: string;
|
|
40
40
|
}
|
|
41
|
-
export declare function
|
|
41
|
+
export declare function oauthYandexEventHandler({ config, onSuccess, onError, }: OAuthConfig<OAuthYandexConfig>): import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<void>>;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { withQuery, parseURL, stringifyParsedURL } from "ufo";
|
|
9
9
|
import { defu } from "defu";
|
|
10
10
|
import { useRuntimeConfig } from "#imports";
|
|
11
|
-
export function
|
|
11
|
+
export function oauthYandexEventHandler({
|
|
12
12
|
config,
|
|
13
13
|
onSuccess,
|
|
14
14
|
onError
|
package/package.json
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { githubEventHandler } from '../lib/oauth/github.js';
|
|
2
|
-
import { googleEventHandler } from '../lib/oauth/google.js';
|
|
3
|
-
import { spotifyEventHandler } from '../lib/oauth/spotify.js';
|
|
4
|
-
import { twitchEventHandler } from '../lib/oauth/twitch.js';
|
|
5
|
-
import { auth0EventHandler } from '../lib/oauth/auth0.js';
|
|
6
|
-
import { microsoftEventHandler } from '../lib/oauth/microsoft.js';
|
|
7
|
-
import { discordEventHandler } from '../lib/oauth/discord.js';
|
|
8
|
-
import { battledotnetEventHandler } from '../lib/oauth/battledotnet.js';
|
|
9
|
-
import { keycloakEventHandler } from '../lib/oauth/keycloak.js';
|
|
10
|
-
import { linkedinEventHandler } from '../lib/oauth/linkedin.js';
|
|
11
|
-
import { cognitoEventHandler } from '../lib/oauth/cognito.js';
|
|
12
|
-
import { facebookEventHandler } from '../lib/oauth/facebook.js';
|
|
13
|
-
import { paypalEventHandler } from '../lib/oauth/paypal.js';
|
|
14
|
-
import { steamEventHandler } from '../lib/oauth/steam.js';
|
|
15
|
-
import { xEventHandler } from '../lib/oauth/x.js';
|
|
16
|
-
import { xsuaaEventHandler } from '../lib/oauth/xsuaa.js';
|
|
17
|
-
import { yandexEventHandler } from '../lib/oauth/yandex.js';
|
|
18
|
-
export declare const oauth: {
|
|
19
|
-
githubEventHandler: typeof githubEventHandler;
|
|
20
|
-
spotifyEventHandler: typeof spotifyEventHandler;
|
|
21
|
-
googleEventHandler: typeof googleEventHandler;
|
|
22
|
-
twitchEventHandler: typeof twitchEventHandler;
|
|
23
|
-
auth0EventHandler: typeof auth0EventHandler;
|
|
24
|
-
microsoftEventHandler: typeof microsoftEventHandler;
|
|
25
|
-
discordEventHandler: typeof discordEventHandler;
|
|
26
|
-
battledotnetEventHandler: typeof battledotnetEventHandler;
|
|
27
|
-
keycloakEventHandler: typeof keycloakEventHandler;
|
|
28
|
-
linkedinEventHandler: typeof linkedinEventHandler;
|
|
29
|
-
cognitoEventHandler: typeof cognitoEventHandler;
|
|
30
|
-
facebookEventHandler: typeof facebookEventHandler;
|
|
31
|
-
paypalEventHandler: typeof paypalEventHandler;
|
|
32
|
-
steamEventHandler: typeof steamEventHandler;
|
|
33
|
-
xEventHandler: typeof xEventHandler;
|
|
34
|
-
xsuaaEventHandler: typeof xsuaaEventHandler;
|
|
35
|
-
yandexEventHandler: typeof yandexEventHandler;
|
|
36
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { githubEventHandler } from "../lib/oauth/github.js";
|
|
2
|
-
import { googleEventHandler } from "../lib/oauth/google.js";
|
|
3
|
-
import { spotifyEventHandler } from "../lib/oauth/spotify.js";
|
|
4
|
-
import { twitchEventHandler } from "../lib/oauth/twitch.js";
|
|
5
|
-
import { auth0EventHandler } from "../lib/oauth/auth0.js";
|
|
6
|
-
import { microsoftEventHandler } from "../lib/oauth/microsoft.js";
|
|
7
|
-
import { discordEventHandler } from "../lib/oauth/discord.js";
|
|
8
|
-
import { battledotnetEventHandler } from "../lib/oauth/battledotnet.js";
|
|
9
|
-
import { keycloakEventHandler } from "../lib/oauth/keycloak.js";
|
|
10
|
-
import { linkedinEventHandler } from "../lib/oauth/linkedin.js";
|
|
11
|
-
import { cognitoEventHandler } from "../lib/oauth/cognito.js";
|
|
12
|
-
import { facebookEventHandler } from "../lib/oauth/facebook.js";
|
|
13
|
-
import { paypalEventHandler } from "../lib/oauth/paypal.js";
|
|
14
|
-
import { steamEventHandler } from "../lib/oauth/steam.js";
|
|
15
|
-
import { xEventHandler } from "../lib/oauth/x.js";
|
|
16
|
-
import { xsuaaEventHandler } from "../lib/oauth/xsuaa.js";
|
|
17
|
-
import { yandexEventHandler } from "../lib/oauth/yandex.js";
|
|
18
|
-
export const oauth = {
|
|
19
|
-
githubEventHandler,
|
|
20
|
-
spotifyEventHandler,
|
|
21
|
-
googleEventHandler,
|
|
22
|
-
twitchEventHandler,
|
|
23
|
-
auth0EventHandler,
|
|
24
|
-
microsoftEventHandler,
|
|
25
|
-
discordEventHandler,
|
|
26
|
-
battledotnetEventHandler,
|
|
27
|
-
keycloakEventHandler,
|
|
28
|
-
linkedinEventHandler,
|
|
29
|
-
cognitoEventHandler,
|
|
30
|
-
facebookEventHandler,
|
|
31
|
-
paypalEventHandler,
|
|
32
|
-
steamEventHandler,
|
|
33
|
-
xEventHandler,
|
|
34
|
-
xsuaaEventHandler,
|
|
35
|
-
yandexEventHandler
|
|
36
|
-
};
|