1

Okay so, ordinary Django allows you to simply:

if request.user.is_authenticated:

I want to be able to do the same in Pyrebase. Have the views sort of already know which user has logged in based on the current session without having to sign the user in in all views. I have tried:

def sign_in(request):

user = firebase.auth().sign_in_with_email_and_password('email', 'password')
user_token = firebase.auth().refresh(user['refreshToken']
request.session['session_id'] = user_token

I noticed this creates a session ID for me. But I don't know how to associate it with the current user and I know it has something to do with the refresh token. If I don't check authentication, anyone can visit any page of my site without signing in.

Kai
  • 45
  • 6

0 Answers0