-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into test-cicd
- Loading branch information
Showing
107 changed files
with
3,029 additions
and
23,861 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn format | ||
# yarn format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v18.17.0 | ||
v20.10.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,7 @@ | ||
import NextAuth from "next-auth"; | ||
import GithubProvider from "next-auth/providers/github"; | ||
import jwt from "jsonwebtoken"; | ||
import initNextAuth from "@sahil/features/auth/lib/auth"; | ||
|
||
export default NextAuth({ | ||
providers: [ | ||
GithubProvider({ | ||
clientId: process.env.NEXT_PUBLIC_GITHUB_ID, | ||
clientSecret: process.env.NEXT_PUBLIC_GITHUB_SECRET, | ||
}), | ||
], | ||
secret: process.env.SECRET, | ||
jwt: { | ||
// A secret to use for key generation (you should set this explicitly) | ||
secret: process.env.SECRET, | ||
encode: async ({ secret, token, maxAge }: any) => { | ||
const claims = { | ||
sub: token?.sub.toString(), | ||
name: token?.name, | ||
email: token?.email, | ||
iat: Date.now() / 1000, | ||
exp: Math.floor(Date.now() / 1000) + 24 * 60 * 60, | ||
"https://hasura.io/jwt/claims": { | ||
"x-hasura-allowed-roles": ["user"], | ||
"x-hasura-default-role": "user", | ||
"x-hasura-role": "user", | ||
"x-hasura-user-id": token.id, | ||
}, | ||
}; | ||
const options = initNextAuth(); | ||
|
||
const encodedToken = jwt.sign(claims, secret, { algorithm: "HS256" }); | ||
return encodedToken; | ||
}, | ||
decode: async ({ secret, token, maxAge }: any) => { | ||
const decodedToken = jwt.verify(token, secret, { algorithms: ["HS256"] }); | ||
return decodedToken; | ||
}, | ||
}, | ||
pages: { | ||
signIn: "/auth/signin", // Displays signin buttons | ||
signOut: "/auth/signout", // Displays form with sign out button | ||
error: "/auth/error", // Error code passed in query string as ?error= | ||
verifyRequest: "/auth/verify-request", // Used for check email page | ||
newUser: "/auth/new", // If set, new users will be directed here on first sign in | ||
}, | ||
callbacks: { | ||
async session({ session, token }) { | ||
console.log("token", token); | ||
console.log("session", session); | ||
const encodedToken = jwt.sign(token, process.env.SECRET, { | ||
algorithm: "HS256", | ||
}); | ||
// @ts-ignore | ||
session.token = encodedToken; | ||
// @ts-ignore | ||
session.id = token.id; | ||
return session; | ||
}, | ||
async jwt({ token, user, profile, account, isNewUser }) { | ||
console.log("user", user); | ||
console.log("token", token); | ||
const isAuthenticated = user ? true : false; | ||
if (isAuthenticated) { | ||
token.id = user.id; | ||
} | ||
return Promise.resolve(token); | ||
}, | ||
async signIn({ user, account, profile, email, credentials }) { | ||
console.log("user", user); | ||
console.log("account", account); | ||
return true; | ||
}, | ||
}, | ||
|
||
// Events are useful for logging | ||
// https://next-auth.js.org/configuration/events | ||
events: {}, | ||
|
||
// Enable debug messages in the console if you are having problems | ||
debug: true, | ||
}); | ||
// @ts-ignore | ||
export default NextAuth(options); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Oops, something went wrong.