Cognito make username an email google auth - amazon-web-services

How do I make my cognito user pool username an email with google identity provider.
It is very confusing as well. In attribute mappings it says that google sub is username, but username has a format of "Google_randomnumber"
Please help me how do I assign my own username when doing google auth with cognito user pools?

I think if you want the real name, you need to join given name and family name. The user name, you need to add an attribute it's Google username.
This is what looks like when you click the User in Users and Groups:

Related

How to update/create new jwt after user changed username

I use JWT(rest_framework_jwt module) in my project(backend: Django), now I allow user to change his/her username. As we known, after user changed username, the token will invalid(since the token(payload) include the username info, so the current local saved token cannot be used further). Then what we can do?
Logout? and let user re-login?
create new jwt? but how to do this since backend don't have the password(as I know, password is needed to create new jwt).

Django 2 login with email address, phone number or username

What is the best way to implement django 2 login and registration like instagram.com. user can register with username and email or phone and password. after register user can login with email address, phone number or username.
Thanks
A great thing about Django is that it comes with a User model already. You just have to apply it to your site.
Check out the user documentation Here
This will give you all the fields you can use, and how to make a member style website

Custom model for authentication in django restframework instead of default user model

I want to do some custom auth for my users with username or email with password. At the first time of logging with email and password the api should return me the respective user token. For all other operations with the api I need to make use of token, which I get at time of login.
And I need a custom model to store all user info like username, password, phone, email, token etc.
How to achieve this in django restframework.
Please guide me to achieve this. Thanks in advance.
Django rest-framework has a built in token system which can be used to distribute and authenticate tokens. Below is a sample of how to use it.
Create TOKEN
from rest_framework.authtoken.models import Token
user = User.objects.get(pk=some_pk)
token = Token.objects.create(user=user)
Authenticate token
if Token.ojects.get(key=token) # token is sent by client side
# do some task as auth is successful
If you want to extend the default User model then create a new model and put a onetoone field in your custom model which references default User model.
class AppUserProfile(models.Model):
user = models.OneToOneField(User)
... # add other custom fields like address or phone

Django-allauth: being taken to signup form after facebook authentication

After I sign in with facebook, I am taken to a signup form which says You are about to use your Facebook account to login to example.com. As a final step, please complete the following form:
The username field is empty while the email-optional field has been filled up already.
When I try to enter any value, there is an error prompt that says An account already exists with this e-mail address. Please sign in to that account first, then connect your Facebook account.
I don't understand this, for Sign in, I have to enter a username and a password. I haven't setup a username and a password, so I cannot sign in, except try to sign in via Facebook and have the above process repeated again.
From the admin, I can see that a new user has been created in the Users table but no password set up, same in Social Accounts table.

django-allauth passwords with social registration

Basically, the goal is to have valid username/password pair for each registered user.
I think the proper way to do that is to create custom form for social signup.The default workflow for social signup is:
User clicks "Sign in with PROVIDER_NAME";
User gives access to my app on provider's site;
Site redirects him to my app where he should fill additional fields like username etc. and complete registration.
And I need to ask user for passwords too at the last step. Form should validate that passwords and save it to user.
Any ideas? Have no idea how can it be implemented with custom form or adapter.
The purpose of allauth, is to avoid the user to create a new username/password for your site.
However, you can configure a form to add that information.
Set up the form you want to show to the user.
ACCOUNT_SIGNUP_FORM_CLASS = 'project.forms.MyUserForm'