Auth works but not with cookie
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3b5ac81cc3
commit
00cf0d9905
@ -131,9 +131,11 @@ export const KiosMap = () => {
|
||||
width={120}
|
||||
src="/kios-logo.png"
|
||||
alt="" />
|
||||
|
||||
{(myself && myself.name) &&
|
||||
|
||||
{(myself && myself.name)
|
||||
?
|
||||
<p>Logged in as: {myself.name}</p>
|
||||
: <p>Logged in</p>
|
||||
}
|
||||
{
|
||||
(!hasAuthCookie() && !authToken) &&
|
||||
|
@ -9,10 +9,6 @@ const nonAuthHeaders = {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
const authHeaders = {
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
const getMakers = async () => {
|
||||
const url = `${API_URL}/api/makers`
|
||||
console.log("Fetching url:", url)
|
||||
@ -74,12 +70,18 @@ const getMyself = async (authToken: string) => {
|
||||
const url = `${API_URL}/api/users/me`
|
||||
console.log("Fetching url:", url)
|
||||
|
||||
const authHeaders = {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": `JWT ${authToken}`,
|
||||
}
|
||||
|
||||
|
||||
const response = await axios.get(`${API_URL}/api/users/me`, {
|
||||
withCredentials: true,
|
||||
headers: authHeaders
|
||||
});
|
||||
|
||||
const user: User = response.data.docs;
|
||||
const user: User = response.data
|
||||
console.log(`Fetch result from ${url}`, user)
|
||||
return user;
|
||||
|
||||
|
@ -13,6 +13,11 @@ const Users: CollectionConfig = {
|
||||
verify: false, // Require email verification before being allowed to authenticate
|
||||
maxLoginAttempts: 5, // Automatically lock a user out after X amount of failed logins
|
||||
lockTime: 600 * 1000, // Time period to allow the max login attempts
|
||||
cookies: {
|
||||
secure: true,
|
||||
sameSite: "lax",
|
||||
domain: process.env.ASTRO_HOST
|
||||
},
|
||||
},
|
||||
fields: [
|
||||
// Email added by default
|
||||
|
Loading…
Reference in New Issue
Block a user