user.exschema looks like this:
mix phx.gen.authto set
:fetch_current_userplug used in the
:browserpipeline in the router.
user_tokenset in our database for that users session, and from there obtain the logged in user.
user_ueberauth_controller.exthere are callback functions - one for each provider. In these callback functions we take the user info provided by the provider and use that to sign in a user (registering them if they aren't already):
hashed_passwordcolumn, a password will be randomly generated. This way we don't modify the original table structure of the
user.provider) if you like.
user_ueberauth_controller.exfor how to deal with the callbacks. Your main job is taking the data given by the provider and using it to register a user.
user_tokenis generated with the encrypted pin code in it
/passwordless/sign-in-code/:hashed_user_id(user id is obfuscated in a hashed format using the HashId lib)
create_from_token/2will use the token to log the user in (set the appropriate cookie)
secret. This is what is passed to the authenticator app and allows the web application to work out which codes are correct.