User authentication with simple-jwt drf

102 views
Skip to first unread message

Lakshyaraj Dash

unread,
Aug 24, 2022, 9:54:23 AM8/24/22
to django...@googlegroups.com
Hello everyone,
I want to create a user authentication app using ReactJS and django. But facing problems in authenticating with the jsonwebtokens in ReactJS. Can anybody provide correct guide of implementing DjangoRestFramework simple-jwt and ReactJS jet ?

Aman Stark

unread,
Aug 25, 2022, 3:03:33 PM8/25/22
to Django users
Can we use 2-3 level of primary key like .  (1/1 , 1/2 , 1/3 ) , (2/1,2/2,2/3) .

Ahmed Abdelmonem

unread,
Aug 25, 2022, 5:45:00 PM8/25/22
to django...@googlegroups.com
Use validate method to output the user details (name, age, ...etc)  along side with the token, now you have the token and the user, u don't have to extract the user from the token.
use the token and the user together instead of using the token only in React


check this, line 69

Here is the full project (Django DRF for backend, React for Front-end )

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a555f04d-b312-4626-9bfc-1b46c6826d5cn%40googlegroups.com.

Samuel Alie Mansaray

unread,
Aug 29, 2022, 10:06:32 AM8/29/22
to django...@googlegroups.com
Hello, am a django beginner, I want to add apps, modules and APIs but am finding it difficult especially with the new version of django because I have been following a tutorial of Version 3.

Please I need help with the updated version.

Kennedy Saavedra

unread,
Aug 30, 2022, 8:17:50 PM8/30/22
to django...@googlegroups.com
What problem do you have ? 

Try with a update in the console with your environment actived.

sudo apt update upgrade

Else:

You can try install:

pip install Django==3.2


Install this version with your environment actived. 



Mobina J

unread,
Aug 31, 2022, 9:14:06 AM8/31/22
to Django users
hii 

import pandas as pd
from django.contrib import messages
from django.core.mail import EmailMessage
from django.shortcuts import render
from django.template.loader import render_to_string
from app_1.form import NotificationForm


def email_generic_template(request):
form = NotificationForm(request.POST)
if form.is_valid():
csv_file = request.FILES['file']
data = pd.read_csv(csv_file)
subj = request.POST.get('subject')
msg = request.POST.get('message')
BCC = request.POST.get('bcc_email')
CC = request.POST.get('cc_email')
answer = request.POST.get('selected_option')
demo = list()
try:
for k, r in data.iterrows():
value = r.to_dict()
recipient = value["email_id"]
Subject = subj.format(**value)
Body_of_message = msg.format(**value)
bcc = BCC.format(**value)
cc = CC.format(**value)
FROM_EMAIL = "exa...@gmail.com"
html_template = render_to_string('mail_template.html', {'content': Body_of_message})
email1 = EmailMessage(
Subject,
html_template,
FROM_EMAIL,
[recipient],
bcc=[bcc],
cc=[cc]
)
email1.content_subtype = 'html'
sent = email1.send()
value['sent'] = sent
demo.append(value)
if sent == 1:
sent = 'success'
print(sent)
else:
sent = 'Fail'
print(sent)
if answer == 'sample_mail':
break
context = {
'form': form,
'value': demo,
}
return render(request, 'index.html', context)
except Exception as e:
messages.error(request, e)
context = {
'form': form,
'value': demo
}
return render(request, 'index.html', context)

else:
context = {'form': form}
return render(request, 'index.html', context)
  



this is my code...I want to show failed mail to the template...I am new to Django I did not know how to do it. anyone  help me
On Wednesday, August 24, 2022 at 7:24:23 PM UTC+5:30 dashlaksh...@gmail.com wrote:
Hello everyone,
I want to create a user authentication app using ReactJS and django. But facing problems in authenticating with the jsonwebtokens in ReactJS. Can anybody provide correct guide of implementing DjangoRestFramework simple-jwt and ReactJS jet ?


Disclaimer© 2022 VVDN Technologies Pvt. Ltd. This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful.


subin

unread,
Sep 1, 2022, 2:58:02 PM9/1/22
to django...@googlegroups.com
so we can support your needs.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

subin

unread,
Sep 1, 2022, 3:03:03 PM9/1/22
to django...@googlegroups.com
Please let me know if that sounds okay.Thanks again for all your help.Thanks again for all your help.Thanks again for all your help.

Reply all
Reply to author
Forward
0 new messages