Skip to content

Commit d130351

Browse files
committed
fix: Bypass RLS for authentication queries
1 parent beff5af commit d130351

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

app/controllers/concerns/authenticatable.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ def authenticate_request!
2323

2424
begin
2525
@jwt_payload = Authentication::Services::JwtService.decode(token)
26-
@current_user = User.find(@jwt_payload[:user_id])
26+
27+
# Bypass RLS for authentication queries - we need to find the user before we can set RLS context
28+
@current_user = User.unscoped.find(@jwt_payload[:user_id])
2729
@current_organization = @current_user.organization
2830

2931
# Update last login time

0 commit comments

Comments
 (0)