
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
marvin-auth-kit
Advanced tools
This marvin-auth module provides easy implementation with the backend authention module written bij Stijn Van Looy.
Install marvin-auth-kit:
yarn add marvin-auth-kit
All authentication methods are available on the auth object. Import and configure the package, if needed!
Default config is to connect to the current domain and /auth-api path
import { auth } from 'marvin-auth-kit';
// configure auth instance
auth.config({
url: 'authserver.vito.be',
port: 443,
secure: true,
path: '/auth',
});
// validate backend compatiblity
auth.validateCompatibility();
Now you can have fun with authentication:
auth.login(‘username’, ‘password’);
const isLoggedIn = await auth.isAuthenticated;
auth.applyInterceptors( { AxiosStatic instance } );
auth.ejectInterceptors( { AxiosStatic instance } );
auth.refresh();
auth.logout();
Set and read the configuration of the package
import { config } from 'marvin-auth-kit';
//Sets the config of the auth package
config.set({ ConfigObject });
//Gets the parsed config of the auth package
config.get();
//Example config object
{
port: 443,
path: '/auth',
url: 'authentication.server.vito.be',
secure: true,
}
//get the config of the auth server, only available for root users
config.server();
//Sets the config of the auth server, only available for root users
config.serverSet({ ServerConfigObject });
Use this module to change the e-mail of the current logged in user, this must be done by a request with is validated by sending a token to that e-mail.
import { email } from 'marvin-auth-kit';
//Request an email change of the logged in user
email.request(email);
//Confirms the email change ( Token is send to the email address provided)
email.confirm(token);
Change the password of a user, or the logged in user. Validation occurs by sending an email to the user.
import { password } from 'marvin-auth-kit';
//Change the password of the logged in user
password.change(newPassword);
//Request an password change of the logged in user
password.request(email);
//Confirms the password change ( Token is send to the email address of the user)
password.confirm(token, newPassword);
Request a new user account for the application, this must be allowed on the server side!
import { register } from 'marvin-auth-kit';
//Request a new user account
register.request(email, password);
//Request a new user account, with metadata. This must be an object
register.request(email, password, metadata);
//Confirms the registration ( Token is send to the email address of the user)
register.confirm(token);
Request a new password for a user
import { reset } from 'marvin-auth-kit';
//Request a reset password link, only available for root users
reset.request(id);
//Set a new password ( Token is send to the email address of the user)
reset.confirm(token, newPassword);
Manage the user base, create, update and delete users. Use users.update to assign new roles to a user.
import { users } from 'marvin-auth-kit';
users.create({ UserObject });
users.get({ UserObject } || id);
users.query({ email, role, enabled, offset, limit, sort, metadata });
users.update({ UserObject });
users.delete({ UserObject } || id);
optional, by default no metadata filtering is applied
A metadata filter contains 2 parts separated by a ~ sign (path~pattern)
The path part is the json path in the metadata object, field names are separated by a . sign (level1field.level2field.level3field)
The pattern part uses "database" syntax:
- % = 0, 1, or more characters;
- _ = 1 character
Note that the json fields nor the patterns can contain the used separators (. ~), if they do the metadata filtering won't work (as expected)
Manage your metadata: get, update and delete your metadata Allows you to manage the metadata of the authenticated user.
import { metadata } from 'marvin-auth-kit';
metadata.get<MetdataObject>();
metadata.update<MetdataObject>({ MetdataObject });
metadata.delete();
Manage the roles: create, update and delete roles
import { roles } from 'marvin-auth-kit';
roles.create({ RoleObject });
roles.query({ offset, limit });
roles.update({ RoleObject });
roles.delete({ RoleObject } || id);
The tokens are automatically added to each axios instance after login. Incase you have multiple instances you can attach interceptors to it.
import axios from 'axios';
import { auth } from 'marvin-auth-kit';
const _privateInstance = axios.createInstance();
//apply the tokens
auth.applyInterceptors(_privateInstance);
//Remove the tokens incase clean up is needed!
auth.ejectInterceptors(_privateInstance);
You can use this component to guard your route with login, the component will check if the user is still logged in.
If they are still logged in it will show the component passed,
else it will redirect the user to /login, by default
It's possible that the component will refresh the tokens, in this case it will show the loader.
import { PrivateGuard } from 'marvin-auth-kit';
<Route
path="/"
element={
<PrivateGuard redirectTo="/login" loader={<FullScreenCircularProgress />} />
}
>
<Route path="/admin" element={<SomeProtectedPage />} />
</Route>;
You can use this component inconjunction of the login route, the component will check if the user is still logged in.
If they are still logged in it will redirect to the next page and skip the login process,
else it will show the component passed, this should be a component containing the login form
It's possible that the component will refresh the tokens, in this case it will show the loader.
import { LoginGuard } from 'marvin-auth-kit';
<Route
path="/login"
element={
<LoginGuard redirectTo="/app" loader={<FullScreenCircularProgress />} />
}
>
<Route index element={<LoginLayout />}>
<Route index element={<LoginPage />} />
</Route>
</Route>;
FAQs
Javscript authentication kit
The npm package marvin-auth-kit receives a total of 31 weekly downloads. As such, marvin-auth-kit popularity was classified as not popular.
We found that marvin-auth-kit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.