Skip to content

YashKumarVerma/uniauth-backend

Repository files navigation

UniAuth Backend

GitHub issues GitHub pull requests GitHub last commit Gitlab code coverage GitHub top language Docker Automated build CodeFactor Ensure Build

Deploy

Objective

The detailed objective is available on the /UniAuth repository.


Docs

Running on Local System

Running the project on local system is strongly recommended, even if you are not working on the backend. This is becuase to test the middlewars, client applications, or any other component, an instance of UniAuth OAuth server is required. Make sure that you have a mongodb instance running. This step might be different depending on your installation type. If you do not have mongodb database installed, refer this link

  • Clone the repository to your system using git clone https://github.com/UniAuth/uniauth-backend
  • Now open the cloned repository using cd uniauth-backend
  • The project depends on numerous npm packages. Install them using yarn install or npm install
  • Run yarn start:dev or npm run start:dev to launch a development server.
  • Open localhost:5000 and ensure that the server is running.

Seems a long process? We have an open issue to create a docker image to make this short. Help us out by sending a pr.

Creating an Application

Once you have a server running(use the above steps if not), now you'll need to create a user account and application credentials just like any other user would. The steps are:

  • Open localhost:5000/account/register and fill in your details. Enter any random 9 digit word for registration number. This is added to demonstrate that custom fields can be added during registration itself.
    There are some validations in the system , so kindly follow the following format :
    Format for registration number : [2 digit year][3 character code][4 digit number]
    Example: 19BCE2669, 19MIT0001, 20BTC0010 etc.

Registration page

  • The page will ask you to please check your email for verification link. The email part is not integrated yet. So nothing to be done here. Head towards login and use the email and password you used to register right now.

  • Once logged in, you will see your dashboard. Please note that these are placeholder images only.

  • Head towards "Dev Arena" and click on "New Application"

  • Enter the details of the application and click on "Create Application". Ideally the page must refresh itself, if it doesn't, then manually refresh it. (create issue for this please). Application Details

  • Here you can see the details of the newly created application.

    Application Details

  • Now you can use the application details in middlewares and clients.

UniAuth Flow

OAuth Flow

Consent Screen

The user sees the following screen when during login Simple Consent Screen for event

Technologies Used

  • Backend

  • Frontend

  • Database

    Generating An Api Key From SendGrid

    • SignUp on (https://sendgrid.com/)
    • LogIn to your account and create a sender identity by following the onscreen instructions.
    • Verify the identity by clicking on the email sent to the email address that you used to create the sender identity.
    • Once the sender identity is verified Click on "Send Your First Email"
    • Choose "SMTP Relay" option.
    • Create an API key by entering a text in the input field
    • Once the API is generated you will be able to see the username and the passkey. The passkey is the API that you generated.
    • Copy paste the username and passkey in "user" and "pass" fields under "auth" property of "nodemailer_config" in the "default.yml" file inside the "Config" folder which is in the root directory.
    • Save the changes.
    • Link to the tutorial : (https://www.youtube.com/watch?v=wViybWxSAAQ&ab_channel=NickBisignano) - Follow ony till the api key is generated.