Skip to content

Commit

Permalink
Set CLI's auth token expiry to a year (#1629)
Browse files Browse the repository at this point in the history
* Extend CLI JWT expiry by a year

* Remove import
  • Loading branch information
nessup authored Sep 7, 2023
1 parent 6a39ddf commit afc709f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pages/cli/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { PiWarningFill } from "react-icons/pi";
import { Button, Card, FormLabel, Heading, Link, Text } from "tw-components";
import { ThirdwebNextPage } from "utils/types";

const CLI_LOGIN_TOKEN_DURATION_IN_SECONDS = 60 * 60 * 24 * 365;

const LoginPage: ThirdwebNextPage = () => {
const { payload } = useRouter().query;
const { mutateAsync: authorizeWallet } = useAuthorizeWalletWithAccount();
Expand Down Expand Up @@ -69,7 +71,11 @@ const LoginPage: ThirdwebNextPage = () => {
const parsedPayload = JSON.parse(decodedPayload);
let token;
try {
token = await auth?.generate(parsedPayload);
token = await auth?.generate(parsedPayload, {
expirationTime: new Date(
Date.now() + 1000 * CLI_LOGIN_TOKEN_DURATION_IN_SECONDS,
),
});
} catch (e) {
setLoading(false);
setRejected(true);
Expand Down

0 comments on commit afc709f

Please sign in to comment.