The Social Login feature has been implemented using dj-rest-auth library.
By using dj-rest-auth library, we can have a social login system suitable for REST API based projects.
You have to have a Client ID and Secret Key to be able to use this feature.
The project is Dockerized which makes it easy to run locally and deploy to a server.
The Main requirement is you need to have Docker installed on your machine.
Steps to follow:
- GENERATE keys. You need to generate social app keys for GitHub and Google.
- RENAME the .env files.
- Rename .env.developer file to .env
- Rename .env-react.developer file to .env-react
- PLACE the keys to correct spots in both .env and .env-react files.
- RUN
docker compose up
. - VISIT http://localhost:5173 to view and test the project!
To be able to use the social login features of the providers(like GitHub, Google, FaceBook...), you need to create a social/OAuth app using your account with each provider.
Unfortunately, creating these apps is provider-specific which makes the process a bit hard for beginners.
Here are some tutorials you can use:
-
Tutorial for GitHub social app creation.
-
Google social app tutorial.
*** DO NOT FORGET to set callback urls correctly:
- Google: http://127.0.0.1:8000/accounts/google/login/callback/
- Github: http://localhost:8000/accounts/github/login/callback/ *
*Somehow 127.0.0.1 doesn't work for GitHub, try using localhost instead.
Don't forget to have fun! :)