Next.js Discord

Discord Forum

Guys is it possible to get the latest logins with Next-auth V5?

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
I want to show the 5 last users logged in here :

14 Replies

Asiatic LionOP
And is there anyway to get the website statics?
And see it in the app's dashboard?
Asiatic LionOP
>>
Asiatic LionOP
BUMP
Toyger
in next_auth.sessions table you have expires timestamp, you can select last 5 sorted by this column
I mean what is the code for getting the table?
@Asiatic Lion I mean what is the code for getting the table?
Toyger
use whatever provider you use for database to select data from sessions table, I don't know what exactly you use postgres/mongo/etc... for example here you can see postgres table structure https://authjs.dev/getting-started/adapters/pg
@Asiatic Lion And is there anyway to get the website statics?
Asiatic LionOP
@Toyger What abt this?
Do you know something about it?
I really don't know what to add for an agency's dashboard😂
@Asiatic Lion <@536484914221285376> What abt this?
Toyger
what statistics do you need ?
@Toyger what statistics do you need ?
Asiatic LionOP
Views
@Asiatic Lion Views
Toyger
you can try google analytics https://dev.to/collinsruto/add-google-analyticts-to-nextjs-134-app-dir-51c5
this tutorial should work fine for next14
but probably you still better add pageviews to each route useEffect client component
ReactGA.send({ hitType: "pageview", page: "/my-path", title: "Custom Title" });