Skip to content

Commit

Permalink
fix generaterefreshtoken missing argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Yigithan Karabulut committed Jul 17, 2024
1 parent 529a30a commit 68e8e9c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions authservice/src/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def generate_access_token(user_id):


def generate_refresh_token(user_id, access_token, exp, iat):
if not exp:
if exp is None:
exp = datetime.utcnow() + timedelta(days=7)
if not iat:
if iat is None:
iat = datetime.utcnow()
payload = {
'user_id': user_id,
Expand All @@ -44,7 +44,7 @@ def generate_tokens(self, request):
return Response(req.errors, status=400)
user_id = req.validated_data['user_id']
access_token = generate_access_token(user_id)
refresh_token = generate_refresh_token(user_id, access_token)
refresh_token = generate_refresh_token(user_id, access_token, None, None)
return Response({
'access_token': access_token,
'refresh_token': refresh_token
Expand Down Expand Up @@ -123,7 +123,7 @@ def intra_oauth_callback(self, request):
response_data = user_creation_response.json().get('data')
user_id = response_data[0].get('id')
token = generate_access_token(user_id)
refresh_token = generate_refresh_token(user_id, token)
refresh_token = generate_refresh_token(user_id, token, None, None)

# 207 status code is for username already exist.
# Redirect to frontend for update username. Otherwise, redirect to homepage
Expand Down

0 comments on commit 68e8e9c

Please sign in to comment.