Skip to content

Commit 183a628

Browse files
Change access token name
1 parent 8660c5a commit 183a628

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/auth/Login.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ export default function Login(): React.ReactElement {
2323
// Automatically redirect user to first supported auth method
2424
// Unless there is ekirjasto authentication, then redirect to that
2525
React.useEffect(() => {
26-
const ekirjastoAuth = supportedAuthMethods.find(
27-
method => method.type === EKIRJASTO_AUTH_TYPE
28-
);
29-
if (ekirjastoAuth) {
30-
initLogin(ekirjastoAuth.id);
31-
}
3226
if (supportedAuthMethods.length > 0) {
33-
initLogin(supportedAuthMethods[0].id);
27+
const ekirjastoAuth = supportedAuthMethods.find(
28+
method => method.type === EKIRJASTO_AUTH_TYPE
29+
);
30+
if (ekirjastoAuth) {
31+
initLogin(ekirjastoAuth.id);
32+
} else {
33+
initLogin(supportedAuthMethods[0].id);
34+
}
3435
}
3536
}, [supportedAuthMethods, initLogin]);
3637

src/pages/api/authsuccess.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ export default async function handler(
2424
const authenticateHref = await fetchEkirjastoAuthenticationLink();
2525

2626
// Get circulation token
27-
const { accessToken } = await fetchEAuthToken(authenticateHref, token);
27+
const { access_token: accessToken } = await fetchEAuthToken(
28+
authenticateHref,
29+
token
30+
);
2831

2932
// Set the circulation token as a cookie that can be read on the other page and stored
3033
res.setHeader(

0 commit comments

Comments
 (0)