CodeHubOrg / codehub-mentorships

CodeHub Mentorship platform - built with Laravel and React
3 stars 0 forks source link

Registration and authentication #27

Open fourstacks opened 4 years ago

fourstacks commented 4 years ago

The problem

We want all activity on the application to take place in an authenticated state. Using InertiaJS means that we can use the session-based authentication provided by Laravel out of the box. We've decided to support two modes of registration and authentication:

  1. Email/Password authentication. In this approach the user signs up using an email and a password. During registration we'll also ask for a couple of bits of extra information such as first name, last name and perhaps a display name. A User model will be created in our application that stores these bits of information and this User model can be used in various ways in our application (for example we'll relate mentor/mentee profiles to the User model etc).

  2. Social authentication. In this approach a user can both register and authenticate using a social platform - in this case Slack. On initial sign in, a User model will be created in our application and the details of that User model will be filled from the social platform. On subsequent sign-ins, this User model in our system will be recalled for use.

The approach

Laravel does much of the work we need. We'll need to run the authentication scaffolding:

https://laravel.com/docs/7.x/authentication#authentication-quickstart https://laravel.com/docs/7.x/frontend#using-react

This will need to be tweaked a little to meet our needs. We can use the Tailwind UI login form component as the basis of our UI:

https://tailwindui.com/components/application-ui/forms/sign-in-forms

With a little effort we'll have basic email/password authentication set up. We'll then need to take a look at Laravel Socialite which we'll use to handle social authentication:

https://laravel.com/docs/7.x/socialite

Socialite comes with many drivers for different social platforms - the Slack one is here:

https://socialiteproviders.netlify.com/providers/slack.html

This should hopefully be a case of following the instructions.


This feature has a reasonable amount of Laravel work so it's worth having at least two people working on this - one with some familiarity with Laravel

stiffneckjim commented 4 years ago

This feature is now an Epic, a name given to large user stories by people who make money giving things names and then selling books about them. I've created two user stories underneath this epic, so far: one for authenticating with the app using GitHub and the other with Slack.

AlisonYoon commented 4 years ago

In the laradock directory, run docker-compose exec workspace bash and then run composer require laravel/ui "^1.2"