#Remix Auth v4 - For Remix and React Router v7 apps

1 messages · Page 1 of 1 (latest)

remote flower
#

I just released Remix Auth v4, this new major version comes with an important change, not only drops Remix v2 so it can be used on RRv7 apps, it also drops RR so it can be used on both Remix and RRv7 apps! Even on Remix v1 apps! Even on any other framework that support Request/Response!

This version simplifies a lot the core library (Authenticator and Strategy classes) so they don't have any dependency, strategies are now encouraged to ask for any Cookie or SessionStorage they may need to work and with the recommended @mjackson/headers package to deal with cookie it's even possible for strategies to remain agnostic of both Remix and RR.

This also means Remix Auth API is simplified, this is all you need now

import { Authenticator } from "remix-auth";
export const authenticator = new Authenticator<User>(); // no options needed
authenticator.use(new SomeStrategy(verifyFunction)) // register a strategy

// this user matches the User generic type
let user = await authenticator.authenticate("strategy-name", request) // no more options

The strategy needs to extends the abstract class Strategy exported now from remix-auth/strategy, each strategy may require extra arguments in the constructor where they could ask for a cookie if needed.

Remember each strategy is published individually and by different members of the community, so they need to upgrade to support Remix Auth v4 one by one, if your strategy is not updated reach out the author or fork it

https://github.com/sergiodxa/remix-auth/releases/tag/v4.0.0

GitHub

What's Changed
New Features

Modernize package setup by @sergiodxa in #295
Drop RR requirement and simplify library a lot by @sergiodxa in #299

Documentation Changes

Fix typo on JSDoc text by...

lone karma
#

Amazing, Sergio! Thanks a lot!

rocky meteor
#

What structure is User, especially with the OAuth2Strategy? Is it the claims object?

#

And what is getUser?

remote flower
remote flower
rocky meteor
#

I'm none the wiser. Is there an example repo using Keycloak and a fresh reactrouterv7 project?
Should I create a help thread?

remote flower