Skip to content

Commit

Permalink
Update logging strategy (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulAsjes authored Nov 4, 2024
1 parent 2c88870 commit 32d5bcd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workos-inc/authkit-remix",
"version": "0.4.0",
"version": "0.4.1",
"description": "Authentication and session helpers for using WorkOS & AuthKit with Remix",
"sideEffects": false,
"type": "commonjs",
Expand Down
4 changes: 2 additions & 2 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ async function updateSession(request: Request, debug: boolean) {
}

try {
if (debug) console.log('Session invalid. Attempting refresh', session.refreshToken);
if (debug) console.log(`Session invalid. Refreshing access token that ends in ${session.accessToken.slice(-10)}`);

// If the session is invalid (i.e. the access token has expired) attempt to re-authenticate with the refresh token
const { accessToken, refreshToken } = await workos.userManagement.authenticateWithRefreshToken({
clientId: WORKOS_CLIENT_ID,
refreshToken: session.refreshToken,
});

if (debug) console.log('Refresh successful:', refreshToken);
if (debug) console.log(`Refresh successful. New access token ends in ${accessToken.slice(-10)}`);

const newSession = {
accessToken,
Expand Down
2 changes: 1 addition & 1 deletion src/workos.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { WorkOS } from '@workos-inc/node';
import { WORKOS_API_HOSTNAME, WORKOS_API_HTTPS, WORKOS_API_KEY, WORKOS_API_PORT } from './env-variables.js';

const VERSION = '0.4.0';
const VERSION = '0.4.1';

const options = {
apiHostname: WORKOS_API_HOSTNAME,
Expand Down

0 comments on commit 32d5bcd

Please sign in to comment.