![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@accounts/express-session
Advanced tools
Stores the access and refresh tokens as part of the session (`express-session`), this way auth flow could be based on it.
Stores the access and refresh tokens as part of the session (express-session
), this way auth flow could be based on it.
yarn add @accounts/express-session
import * as express from 'express';
import * as session from 'express-session';
import { Tokens } from '@accounts/types';
import AccountsSession from '@accounts/express-session';
import { accountsServer } from './setup';
const accountsSession = new AccountsSession(accountsServer, {
user: {
name: 'currentUser',
resolve: (tokens: Tokens) => {
// function that returns a user object
}
}
});
const app = express();
app.use(
session({
name: 'id',
secret: 'secret',
rolling: true,
cookie: { ... }, // cookie options
})
);
app.use(accountsSession.middleware())
app.get('/me', (req, res) => {
const user = req.currentUser; // middleware assings a user object to `req`
res.json(user);
});
app.post('/login', (req, res) => {
let tokens: Tokens; // Tokens AccountsServer
// ... a logic to log user in
accountsSession.set(req, tokens); // sets tokens on request so middleware can access that
});
app.get('/logout', (req, res) => {
accountsSession.destroy(req); // destroys the session and logs user out
});
Specifies the name of a property that holds a user object. For example, By using currentUser
, a user object is accesible on req.currentUser
.
By default it uses: user
Function that receives an access and a refresh tokens to resolve a user object.
(tokens: Tokens) => User | Promise<User>
By default it uses AccountsServer's API to resolve a user.
Specifies the name of a property that holds the Tokens. For example, By using tokens
, tokens are accesible on req.tokens
.
By default it uses: accounts-js-tokens
MIT
FAQs
Stores the access and refresh tokens as part of the session (`express-session`), this way auth flow could be based on it.
We found that @accounts/express-session demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.