Skip to content

Commit

Permalink
fix refresh token check
Browse files Browse the repository at this point in the history
  • Loading branch information
crlssn committed Nov 18, 2024
1 parent b4116ec commit 0f851f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions apps/backend/pkg/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,11 @@ func (r *Repo) DeleteRefreshToken(ctx context.Context, refreshToken string) erro
}

func (r *Repo) RefreshTokenExists(ctx context.Context, refreshToken string) (bool, error) {
if _, err := orm.Auths(orm.AuthWhere.RefreshToken.EQ(null.StringFrom(refreshToken))).Exists(ctx, r.executor()); err != nil {
exists, err := orm.Auths(orm.AuthWhere.RefreshToken.EQ(null.StringFrom(refreshToken))).Exists(ctx, r.executor())
if err != nil {
return false, fmt.Errorf("refresh token exists check: %w", err)
}
return true, nil
return exists, nil
}

type CreateUserParams struct {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/jwt/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function RefreshAccessTokenOrLogout(): Promise<void | NavigationFai
export function ScheduleTokenRefresh(): number {
// const interval = 10 * 60 * 1000; // 10 minutes
const interval = 60 * 1000; // 1 minute
console.log('scheduling access token refresh');
console.log('scheduling access token refresh every minute');
return window.setInterval(async () => {
try {
console.log('refreshing access token');
Expand Down

0 comments on commit 0f851f6

Please sign in to comment.