Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@genezio/auth
Advanced tools
@genezio/auth
@genezio/auth
is a package that provided by genezio
to ensure comprehensive solutions for integrating various authentication providers into a genezio
application.
genezio
application.@genezio/auth
To install the @genezio/auth
package, you can use npm or yarn:
npm install @genezio/auth
yarn add @genezio/auth
At the beginning you need to configure the authentication token and region of your genezio
application. These can be found Authentication Configuration screen on the genezio
Dashboard.
import { AuthService } from "@genezio/auth";
AuthService.getInstance().setTokenAndRegion("<token>", "<region>");
This will trigger the AuthService's register method whenever someone clicks the "Sign Up" button:
const handleSubmit = async (event: React.FormEvent) => {
event.preventDefault();
setLoading(true);
try {
const response = await AuthService.getInstance().register(email, password, name);
console.log('Register Success', response);
navigate('/login');
} catch (error: any) {
console.log(error);
alert("An error has occured")
}
setLoading(false);
};
This will trigger the AuthService's login method whenever someone clicks the "Login" button:
const handleSubmit = async (event: React.FormEvent) => {
event.preventDefault();
setLoginLoading(true);
try {
await AuthService.getInstance().login(email, password)
navigate("/");
} catch (error: any) {
console.log('Login Failed', error);
alert('Login Failed');
}
setLoginLoading(false);
}
This will trigger the AuthService's googleRegistration method whenever someone clicks the Google login button:
const handleGoogleLogin = async (credentialResponse: CredentialResponse) => {
console.log(credentialResponse);
setGoogleLoginLoading(true);
try {
await AuthService.getInstance().googleRegistration(credentialResponse.credential!)
console.log('Login Success');
navigate('/');
} catch(error: any) {
console.log('Login Failed', error);
alert('Login Failed');
}
setGoogleLoginLoading(false);
};
The userInfo
method on the AuthService
is for getting the user's information. You can use this method to check if the user is logged in or not.
useEffect(() => {
if (name && email) {
return;
}
AuthService.getInstance().userInfo().then((user) => {
setName(user.name!);
setEmail(user.email);
}).catch((error) => {
console.error(error);
})
}, []);
The logout
method on the AuthService
is for logging the user out.
const logout = async () => {
try {
await AuthService.getInstance().logout();
navigate('/login');
} catch (error) {
console.error(error);
}
}
The ErrorCode
enum contains all the error codes that can be thrown by the @genezio/auth
package.
import { AuthService, ErrorCode } from '@genezio/auth';
const handleSubmit = async (event: React.FormEvent) => {
event.preventDefault();
setLoading(true);
try {
const response = await AuthService.getInstance().register(email, password, name);
console.log('Register Success', response);
navigate('/login');
} catch (error: any) {
console.log(error);
if (error.code === ErrorCode.EMAIL_ALREADY_EXISTS) {
alert("Email already exists")
} else {
alert("An error has occured")
}
}
setLoading(false);
};
Here getSecret
method is protected by @GnzAuth
decorator. This will ensure that only authenticated users can access this method.
import { GenezioDeploy, GenezioMethod, GnzAuth, GnzContext } from "@genezio/types";
@GenezioDeploy()
export class BackendClass {
secret: string = "Hello World!";
@GenezioMethod()
@GnzAuth()
async getSecret(context: GnzContext) {
console.log(context.user);
return this.secret;
}
}
To find more details on how to use @genezio/auth
, check out the official documentation
Here you can find some examples:
To find more details on how to use genezio
, check out the official documentation:
If you cannot find what you are looking for in the docs, don't hesitate to drop us a GitHub issue or start a discussion on Discord.
We are here to assist you with any problems or questions you may have while using @genezio/auth
. Don't hesitate to reach out to us on GitHub or join our Discord community for real-time assistance.
@genezio/auth
can be used in Genezio projects developed on macOS, Linux-based distributions, and Windows.
It is designed to work with Node.js versions >= 16.0.0
.
For the most common issues that our users have dealt with, we created a Troubleshooting section in the documentation.
If you don't find the guidance there, drop us a GitHub issue. We are more than happy to help you!
Contributions are welcome! Please see our Contributing Guide for more details.
Show your support by giving us a star :star:, to help others discover genezio
and become part of our community!
There are a growing number of awesome projects deployed with genezio
and we want to shout out about them.
If you deployed a project using genezio
let us know on Discord and we will add it to our Hall Of Fame.
Brag to your friends that you are using genezio
with this awesome badge ->
[![deployed with: genezio](https://img.shields.io/badge/deployed_with-genezio-6742c1.svg?labelColor=62C353&style=flat)](https://github.com/genez-io/genezio)
@genezio/auth
is licensed under GNU General Public License v3.0
. For more information, please refer to LICENSE
FAQs
SDK for accessing genezio authentication system.
The npm package @genezio/auth receives a total of 259 weekly downloads. As such, @genezio/auth popularity was classified as not popular.
We found that @genezio/auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.