Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
maxtyson123 committed Jun 4, 2024
2 parents 32e942a + 53bad8d commit 4c9c65d
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 9 deletions.
14 changes: 7 additions & 7 deletions website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"autoprefixer": "^10.4.14",
"axios": "^1.4.0",
"cross-env": "^7.0.3",
"custom-sweeper": "^0.1.0",
"custom-sweeper": "^0.1.1",
"eslint": "8.37.0",
"eslint-config-next": "^14.2.3",
"ftp": "^0.3.10",
Expand Down
46 changes: 46 additions & 0 deletions website/public/media/images/maxid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions website/src/components/maxid_provider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
export interface MaxIDProfile extends Record<string, any> {
object: string
instance_id: string
email: string
email_verified: boolean
family_name: string
given_name: string
name: string
username: string
picture: string
user_id: string
public_metadata: Record<string, any>
private_metadata: Record<string, any>
unsafe_metadata: Record<string, any>
}

export default function MaxID<P extends MaxIDProfile>(
options: any
): any {
return {
id: "maxid",
name: "Max ID",
type: "oauth",
authorization: {
url: process.env.MAXID_DOMAIN + "/oauth/authorize",
params: { scope: "email profile" },
},
token: process.env.MAXID_DOMAIN + "/oauth/token",
userinfo: process.env.MAXID_DOMAIN + "/oauth/userinfo",
profile(profile: any) {
return {
id: profile.user_id,
name: profile.name,
email: profile.email,
image: profile.picture,
}
},
style: { logo: "https://rongoa.maxtyson.net/media/images/maxid.svg", bg: "#2f2c2c", text: "#fff" },
options,
}
}
8 changes: 7 additions & 1 deletion website/src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ import NextAuth, {NextAuthOptions} from "next-auth";
import {getClient, getTables, makeQuery} from "@/lib/databse";
import {MEMBER_USER_TYPE} from "@/lib/users";
import { Logger } from 'next-axiom';
import MaxID from "@/components/maxid_provider";

/**
* The config options that NextAuth uses when authenticating users
*/
export const authOptions: NextAuthOptions = {
providers: [
MaxID({
clientId: process.env.MAXID_ID ? process.env.MAXID_ID : '',
clientSecret: process.env.MAXID_SECRET ? process.env.MAXID_SECRET : '',
}),
GoogleProvider({
clientId: process.env.GOOGLE_ID ? process.env.GOOGLE_ID : '',
clientSecret: process.env.GOOGLE_SECRET ? process.env.GOOGLE_SECRET : '',
}),
GitHubProvider({
clientId: process.env.GITHUB_ID ? process.env.GITHUB_ID : '',
clientSecret: process.env.GITHUB_SECRET ? process.env.GITHUB_SECRET : '',
})
}),

],
callbacks: {
async jwt({ token, trigger, session}) {
Expand Down

0 comments on commit 4c9c65d

Please sign in to comment.