- Issue created by @lukas.fischer
We use Drupal as headless system. We also want to use session_limit functionality, but when "authenticate" with basic auth, it does not seem to trigger the session_limit functionality.
We habe "HTTP Basic Authentication" enabled - so we use Basic Auth to "trigger a login".
This is how we auth from the frontend:
async login(email, password) {
try {
const loginData = Buffer.from(`${email}:${password}`).toString("base64");
const response = await fetch(this.baseUrl + `/jwt/token?_format=json`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Authorization: `Basic ${loginData}`,
},
});
if (response.ok) {
const data = await response.json();
this.storeUserDetails(data.token, { email });
// Fetch additional user details
const userDetails = await this.fetchUserDetails(data.token);
this.storeUserDetails(data.token, userDetails); // Store all user details
return true;
} else {
throw new Error("Unknown username or bad password");
}
} catch (e) {
throw new Error(e.message);
}
}
Active
2.0
Code