Skip to content

Commit

Permalink
Trying to fix missing access token
Browse files Browse the repository at this point in the history
  • Loading branch information
bduff9 committed Nov 19, 2021
1 parent 08fd06b commit e332982
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
18 changes: 11 additions & 7 deletions pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@ import Adapters from 'next-auth/adapters';
import Providers from 'next-auth/providers';

import Models from '../../../models';
import {
DAYS_IN_WEEK,
HOURS_IN_DAY,
MINUTES_IN_HOUR,
SECONDS_IN_MINUTE,
WEEKS_IN_YEAR,
} from '../../../utils/constants';

const {
DATABASE_URL,
EMAIL_FROM,
EMAIL_PASSWORD,
EMAIL_USERNAME,
JWT_SECRET,
NEXTAUTH_URL,
secret,
} = process.env;

if (!DATABASE_URL) throw new Error('Missing database URL');
Expand Down Expand Up @@ -143,14 +150,11 @@ const options: NextAuthOptions = {
from: EMAIL_FROM,
}),
],
secret: 'The ASWNN Movies application',
secret,
session: {
jwt: true,
maxAge: 30 * 24 * 60 * 60, // 30 days
maxAge:
WEEKS_IN_YEAR * DAYS_IN_WEEK * HOURS_IN_DAY * MINUTES_IN_HOUR * SECONDS_IN_MINUTE,
},
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
site: NEXTAUTH_URL,
};

// ts-prune-ignore-next
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.tsbuildinfo

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,40 @@ export const NEXT_PUBLIC_SITE_URL = process.env.NEXT_PUBLIC_SITE_URL;
export const ITEMS_PER_PAGE = 25;

export const VIEWS = ['Grid', 'List', 'Detail'] as const;

/**
* Number of weeks in a year, used for conversions
*/
export const WEEKS_IN_YEAR = 52;

/**
* Number of days in a month, used for conversions
*/
// ts-prune-ignore-next
export const DAYS_IN_MONTH = 30;

/**
* Number of days in a week, used for conversions
*/
export const DAYS_IN_WEEK = 7;

/**
* Number of hours in a day, used for conversions
*/
export const HOURS_IN_DAY = 24;

/**
* Number of minutes in an hour, used for conversions
*/
export const MINUTES_IN_HOUR = 60;

/**
* Number of seconds in a minute, used for conversions
*/
export const SECONDS_IN_MINUTE = 60;

/**
* Number of milliseconds in a second, used for conversions
*/
// ts-prune-ignore-next
export const MILLISECONDS_IN_SECOND = 1000;

1 comment on commit e332982

@vercel
Copy link

@vercel vercel bot commented on e332982 Nov 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.