kenny-login 0.0.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/auth.d.ts +15 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +72 -0
- package/dist/auth.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/strapi-api.d.ts +4 -0
- package/dist/utils/strapi-api.d.ts.map +1 -0
- package/dist/utils/strapi-api.js +87 -0
- package/dist/utils/strapi-api.js.map +1 -0
- package/package.json +29 -0
- package/types/next-auth.d.ts +17 -0
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type NextAuthResult } from "next-auth";
|
|
2
|
+
export declare const auth: NextAuthResult["auth"];
|
|
3
|
+
export declare const handlers: {
|
|
4
|
+
POST: (req: import("next/server").NextRequest) => Promise<Response>;
|
|
5
|
+
GET: (req: import("next/server").NextRequest) => Promise<Response>;
|
|
6
|
+
};
|
|
7
|
+
export declare const signIn: <P extends import("@auth/core/providers").ProviderId, R extends boolean = true>(provider?: P, options?: FormData | ({
|
|
8
|
+
redirectTo?: string;
|
|
9
|
+
redirect?: R;
|
|
10
|
+
} & Record<string, any>), authorizationParams?: string[][] | Record<string, string> | string | URLSearchParams) => Promise<R extends false ? any : never>;
|
|
11
|
+
export declare const signOut: <R extends boolean = true>(options?: {
|
|
12
|
+
redirectTo?: string;
|
|
13
|
+
redirect?: R;
|
|
14
|
+
}) => Promise<R extends false ? any : never>;
|
|
15
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AA6E1D,eAAO,MAAM,IAAI,EAAG,cAAc,CAAC,MAAM,CAAuB,CAAC;AACjE,eAAO,MAAM,QAAQ;;;CAA0B,CAAC;AAChD,eAAO,MAAM,MAAM;cAEoiO,CAAC;YAAyJ,CAAC;yJAFvqO,CAAC;AAC5C,eAAO,MAAM,OAAO;cACmzQ,CAAC;YAA0J,CAAC;4CADt7Q,CAAC"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import NextAuth, {} from "next-auth";
|
|
2
|
+
import { SignInError } from "@auth/core/errors";
|
|
3
|
+
import Google from "next-auth/providers/google";
|
|
4
|
+
import Credentials from "next-auth/providers/credentials";
|
|
5
|
+
import MicrosoftEntraID from "next-auth/providers/microsoft-entra-id";
|
|
6
|
+
const nextAuthResult = NextAuth({
|
|
7
|
+
providers: [
|
|
8
|
+
Google,
|
|
9
|
+
MicrosoftEntraID,
|
|
10
|
+
Credentials({
|
|
11
|
+
credentials: {
|
|
12
|
+
email: {
|
|
13
|
+
type: "email",
|
|
14
|
+
label: "Email"
|
|
15
|
+
},
|
|
16
|
+
password: {
|
|
17
|
+
type: "password",
|
|
18
|
+
label: "Password"
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
authorize: async (credentials) => {
|
|
22
|
+
const response = await fetch(new URL(`${process.env.NEXT_PUBLIC_API_URL}/auth/local`), {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: {
|
|
25
|
+
"Content-Type": "application/json"
|
|
26
|
+
},
|
|
27
|
+
body: JSON.stringify({
|
|
28
|
+
identifier: credentials.email,
|
|
29
|
+
password: credentials.password
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
const data = await response.json();
|
|
33
|
+
if (response.status != 200) {
|
|
34
|
+
throw new SignInError(data.error.message);
|
|
35
|
+
}
|
|
36
|
+
const user = { name: data.user.username, email: data.user.email, jwt: data.jwt };
|
|
37
|
+
return user;
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
],
|
|
41
|
+
session: {
|
|
42
|
+
strategy: "jwt"
|
|
43
|
+
},
|
|
44
|
+
callbacks: {
|
|
45
|
+
async session({ session, token }) {
|
|
46
|
+
if (token) {
|
|
47
|
+
session.jwt = token.jwt;
|
|
48
|
+
}
|
|
49
|
+
return session;
|
|
50
|
+
},
|
|
51
|
+
async jwt({ token, user, account }) {
|
|
52
|
+
if (account && user) {
|
|
53
|
+
try {
|
|
54
|
+
const strapiProviderName = account.provider === "microsoft-entra-id"
|
|
55
|
+
? "microsoft" : account.provider;
|
|
56
|
+
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/auth/${strapiProviderName}/callback?access_token=${account.access_token}`);
|
|
57
|
+
const data = await response.json();
|
|
58
|
+
token.jwt = data.jwt;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error("Error in JWT callback:", error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return token;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
export const auth = nextAuthResult.auth;
|
|
69
|
+
export const handlers = nextAuthResult.handlers;
|
|
70
|
+
export const signIn = nextAuthResult.signIn;
|
|
71
|
+
export const signOut = nextAuthResult.signOut;
|
|
72
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAuB,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,MAAM,MAAM,4BAA4B,CAAA;AAC/C,OAAO,WAAW,MAAM,iCAAiC,CAAC;AAC1D,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AAEtE,MAAM,cAAc,GAAG,QAAQ,CAAC;IAC9B,SAAS,EAAE;QACT,MAAM;QACN,gBAAgB;QAChB,WAAW,CAAC;YACV,WAAW,EAAE;gBACX,KAAK,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,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE;YAChC,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;gBACpB,IAAI,CAAC;oBACH,MAAM,kBAAkB,GAAG,OAAO,CAAC,QAAQ,KAAK,oBAAoB;wBAClE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;oBAEnC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,SAAS,kBAAkB,0BAA0B,OAAO,CAAC,YAAY,EAAE,CAC9G,CAAC;oBACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;oBACnC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;gBACvB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;gBACjD,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,IAAI,GAA4B,cAAc,CAAC,IAAI,CAAC;AACjE,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC;AAChD,MAAM,CAAC,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;AAC5C,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function getUser(): Promise<any>;
|
|
2
|
+
export declare function fetchContent(endPoint: string, query: Object | null): Promise<any>;
|
|
3
|
+
export declare function postContent(endpoint: string, updateData: Object): Promise<any>;
|
|
4
|
+
//# sourceMappingURL=strapi-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strapi-api.d.ts","sourceRoot":"","sources":["../../src/utils/strapi-api.ts"],"names":[],"mappings":"AAUA,wBAAsB,OAAO,iBAyB5B;AAKD,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,gBA4BxE;AAED,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAuBrE"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { getSession } from 'next-auth/react';
|
|
2
|
+
import { headers } from 'next/headers';
|
|
3
|
+
//path for endpoing, default to local if not in env
|
|
4
|
+
function getPath(path) {
|
|
5
|
+
return process.env.NEXT_PUBLIC_API_URL ? `${process.env.NEXT_PUBLIC_API_URL}/api/${path}` : `http://localhost:1337/api${path}`;
|
|
6
|
+
}
|
|
7
|
+
// gets user data
|
|
8
|
+
export async function getUser() {
|
|
9
|
+
var requestUrl = getPath('users/me');
|
|
10
|
+
const session = await getSession();
|
|
11
|
+
const options = {
|
|
12
|
+
method: 'GET',
|
|
13
|
+
headers: {
|
|
14
|
+
'Content-Type': 'application/json',
|
|
15
|
+
'Authorization': `Bearer ${session?.jwt}`
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
try {
|
|
19
|
+
const response = await fetch(requestUrl, options);
|
|
20
|
+
if (!response.ok) {
|
|
21
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
22
|
+
}
|
|
23
|
+
const data = await response.json();
|
|
24
|
+
return data;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error("Error feting data: ", error);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// as long as an enpoint is passed it will return
|
|
32
|
+
// endpoint example to pass if there is and articles path 'articles/12'
|
|
33
|
+
// allows for query
|
|
34
|
+
export async function fetchContent(endPoint, query) {
|
|
35
|
+
var requestUrl = getPath(endPoint);
|
|
36
|
+
if (query !== null) {
|
|
37
|
+
const qs = require('qs');
|
|
38
|
+
let stringQuery = qs.stringify(query);
|
|
39
|
+
requestUrl + '?' + stringQuery;
|
|
40
|
+
}
|
|
41
|
+
const session = await getSession();
|
|
42
|
+
const options = {
|
|
43
|
+
method: 'GET',
|
|
44
|
+
headers: {
|
|
45
|
+
'Content-Type': 'application/json',
|
|
46
|
+
//'Authorization': `Bearer ${session?.jwt}` // not sure if needed for public content
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
const response = await fetch(requestUrl, options);
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
53
|
+
}
|
|
54
|
+
const data = await response.json();
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error("Error feting data: ", error);
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// need to define data structure possibly
|
|
63
|
+
export async function postContent(endpoint, updateData) {
|
|
64
|
+
const requestUrl = getPath(endpoint);
|
|
65
|
+
const session = await getSession();
|
|
66
|
+
const options = {
|
|
67
|
+
method: 'POST',
|
|
68
|
+
headers: {
|
|
69
|
+
'Content-Type': 'application/json',
|
|
70
|
+
//'Authentication': `Bearer: ${session.jwt}`
|
|
71
|
+
},
|
|
72
|
+
body: JSON.stringify({ data: updateData }),
|
|
73
|
+
};
|
|
74
|
+
try {
|
|
75
|
+
const response = await fetch(requestUrl, options);
|
|
76
|
+
if (!response.ok) {
|
|
77
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
78
|
+
}
|
|
79
|
+
const result = await response.json();
|
|
80
|
+
return result.data;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.error("Error updating data: ", error);
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=strapi-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strapi-api.js","sourceRoot":"","sources":["../../src/utils/strapi-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,mDAAmD;AACnD,SAAS,OAAO,CAAC,IAAY;IACzB,OAAO,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,4BAA4B,IAAI,EAAE,CAAC;AACnI,CAAC;AAED,iBAAiB;AACjB,MAAM,CAAC,KAAK,UAAU,OAAO;IACzB,IAAI,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,MAAM,UAAU,EAAE,CAAC;IAEnC,MAAM,OAAO,GAAG;QACZ,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACL,cAAc,EAAG,kBAAkB;YACnC,eAAe,EAAE,UAAU,OAAO,EAAE,GAAG,EAAE;SAC5C;KACJ,CAAA;IAED,IAAI,CAAC;QACL,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAElD,IAAG,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,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EAAE,KAAK,CAAC,CAAC;QAC5C,MAAM,KAAK,CAAC;IACb,CAAC;AACJ,CAAC;AACD,yCAAyC;AACzC,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,QAAgB,EAAE,UAAkB;IAClE,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,MAAM,UAAU,EAAE,CAAC;IACnC,MAAM,OAAO,GAAG;QACZ,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACL,cAAc,EAAG,kBAAkB;YACnC,4CAA4C;SAC/C;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAC,IAAI,EAAE,UAAU,EAAC,CAAC;KAC3C,CAAA;IACD,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACrC,OAAO,MAAM,CAAC,IAAI,CAAC;IACvB,CAAC;IAAC,OAAM,KAAK,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAA;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kenny-login",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "fjorge"
|
|
6
|
+
},
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"types"
|
|
10
|
+
],
|
|
11
|
+
"type": "module",
|
|
12
|
+
"module": "dist/index.js",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"ci": "npm run build",
|
|
16
|
+
"build": "rm -rf ./dist && tsc",
|
|
17
|
+
"watch": "rm -rf ./dist && tsc --watch",
|
|
18
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"next": "^15.5.6",
|
|
22
|
+
"next-auth": "^5.0.0-beta.29",
|
|
23
|
+
"react": "^19.2.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^22",
|
|
27
|
+
"typescript": "^5"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import NextAuth, { DefaultSession } from "next-auth";
|
|
2
|
+
|
|
3
|
+
declare module "next-auth" {
|
|
4
|
+
interface User {
|
|
5
|
+
name: string;
|
|
6
|
+
email: string;
|
|
7
|
+
jwt: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface Session extends DefaultSession {
|
|
11
|
+
jwt: string
|
|
12
|
+
user: {
|
|
13
|
+
jwt: string
|
|
14
|
+
} & DefaultSession["user"]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|