Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
auth0-node-client
Advanced tools
Auth0 Node.js Client for logging in and out with browser, and making authenticated requests.
A library for authenticating users of a Node program with traditional browser-based Auth0 authorization flow. Recommended especially for CLIs.
This library uses a browser authorization code flow to authenticate a user. It does this by starting a server locally, and setting the URL of that server as the redirect location for the authorization process.
You will need to add the localhost:{config.redirectPort}
URL to:
By default, the redirect URL is:
http://localhost:63429
And set Token Endpoint Authentication Method to None.
Create the Auth0 node client and export it for your program to use.
// src/globs.ts
export const AUTH0_CLIENT = new Auth0NodeClient({
domain: "AUTH0_DOMAIN.us.auth0.com",
redirectUri: "https://AUTH0_REDIRECT_URI",
clientId: "AUTH0_CLIENT_ID",
audience: "AUTH0_AUDIENCE",
// redirectPort: 5555,
// postLoginRedirect: "https://google.com",
});
Import your client and use it to log in, log out, and make authenticated requests.
// src/bin.ts
import { AUTH0_CLIENT } from "./globs";
/** Log in using the browser. **/
await AUTH0_CLIENT.login();
// Later:
/**
* Make authenticated requests. Authorization header set automatically.
*
* Uses `node-fetch` under the hood to avoid runtime warnings.
*/
await AUTH0_CLIENT.fetch(
"http://my-api.com/endpoint",
{ method: "POST", /* ... */ }
);
Access tokens will automatically be cached on disk and cleared once they expire.
Calls to login(config)
will resolve instantly when the cache is valid.
This library's internals are also all exposed if you wish to use them more
granularly in some other context - authorizeWithBrowser()
, cacheToken()
,
etc.
Thanks to @altostra, @yevk, and @ShlomiAltostra for their work on
altostra-cli-login-auth0
,
which was helpful for reference on browser opening.
Unthanks to the Auth0 team for making OSS authors write this multiple times rather than writing it for developers to use. Auth0 PKCE is not easy to debug by hand!
FAQs
Auth0 Node.js Client for logging in and out with browser, and making authenticated requests.
We found that auth0-node-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.