Example Support Auth Remix.js
Hi everyone, I'm trying to make a usage example for Remix.js Auth and theoretically it works but when I use the client methods it says I'm not authorized.
https://remix.run/resources/remix-auth
Remix Auth | Remix Resources
Simple Authentication for Remix

40 Replies
can you describe the issue more? Were you able to sign in but not being able to reterive session?
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
:v
I will leave this post closed since I overlooked that there was still no stable version and they changed many things about the API
Hello, how are you, yes... I have been updating my test project to v1 for a while and my answer is correct, I can log in and log out normally, the problem lies when I want to use the administrator methods, such as obtaining the list of database users


auth.ts

client.ts

account login app


I am using the 2 parts of the client, it is assumed that with the administrator part if I am logged in I can bring that information that with the normal client does not have this feature
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
@Jeremy

☝️ read more up
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
your whats database adapter using ?
am using prisma adapter
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
:/
is a bug ?
401 is only returned if the role !== "admin". please double check if the user you're logged in role is set to "admin" and there is no whitespace or anything.

the role is admin
and it still returns 401 when you try to list users?
yes

it is my log
can you check before you try to list users there is a valid session? either do
getSession
or useSession
if you're on the client
alos make sure you haven't changed adminRole
in the admin config.

this is cause you're trying to call
authClient
on the sevrer. meaning it can't read cookies. You should use auth.api
and pass the header from the loader request object@bekacru Hello, I think I also missed explaining that I am not using better-auth within the integrated remix server, since I am using a separate server, which I am using as an authentication provider for other applications.
and the Better-Auth package only has the browser client as a consumer and no other server to provide services from.

How the package proposes to do authentications through SSR applications
???
then you can use
authClient
yuo just need to pass the headers to the authClient

Hello everyone, @bekacru after several trial and error attempts I think that using the api and literally the remix of the remix.js headers to make a bypass between better-auth and the remix server, my solution at the moment to be able to use the better-auth authentication service was this thing a bit archaic since the better-auth-client is not able to return the response to be able to manipulate the request at will and avoid this code that It could be visually ugly 😛

his taking into account that we want to manage everything on the server side
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
Hello, how are you, I understand your point but in this case if we pay attention to the detail the cookie is being saved with a "__session" tag which is the REMIX AUTH standard, what happened is that in a moment of madness I tried to remix these authentication methods, which was not possible since they both established the tokens in their own way, for that reason I discarded remix-auth and took a more manual approach for verification of sessions making redundancy a remix of the headers y better-auth
I understand your point of view on how I could interconnect applications through tokenization strategies or similar, but I also find it interesting how these implementations would work directly from the server side, either for some use case (like mine), or directly mere curiosity