Next.js Discord

Discord Forum

Next-Auth with ioredis

Unanswered
Chinese perch posted this in #help-forum
Open in Discord
Chinese perchOP
Is there an existing implementation for using next-auth with ioredis? Obviously there is an adapter for upstash but we have an existing redis store we would like to use

17 Replies

I havent done this
in next-auth
But I think you can get the upstash adapter to play nice
with regular redis
one approach is running your own redis http proxy
(theres an upstash docker container which sets this up, useful for testing)
The code is very reasonable to fork into your own redis adapter
However I suspect you can just instantiate ioredis
and initialize UpstashRedisAdapter with it
Chinese perchOP
thanks for your thoughts
upstashredisadapter expects Redis to come from upstash-redis
how abt implementing an adapter by yourself?
Yeah…
It’s pretty much a copy and paste
From what I can tell
Chinese perchOP
I do find it quite interesting that this isn't something that is already part of next auth. here is the only public resource i've found of someone trying this with their own redis instance (not working for me in next 13) https://github.com/quanhua92/next-auth-ioredis-adapter-example/blob/main/lib/IORedisAdapter.ts.

in terms of running a http proxy to use upstash adapter, there is this https://github.com/mna/upstashdis, but again not ideal.

i was not able to get my own adapter to work