Giter Club home page Giter Club logo

signin-signup-api-using-jakartaee's Introduction

CRUD-REST-API

I have created this API to implement complete login and signup functionality with user authentication by using an access token. To avoid malicious email registration, I have implemented email verification by sending emails via Amazon Simple Email Service. I have deployed this web service on an Amazon EC2 instance which uses Amazon Linux 2023 as an OS. img

Tech Stack

Jax-rs, JPA, Jersey, Tomcat 10, HK2, Jsp, Java 17, Maven, AWS, Mysql

Note:- Here in the demonstration I have deployed the code on local only

Demonstration: How API works?

1. Registration/Create User

{
    "firstName" : "Sarfaraz",
    "lastName" : "Hussain",
    "email" : "[email protected]",
    "password" : "password"
}
  • Http Response and we are creating userId unique as you can see in the response
{
    "email": "[email protected]",
    "firstName": "Sarfaraz",
    "lastName": "Hussain",
    "userId": "XAmzmIfnvrTlfudz3LqigwjD0Yu5w3"
}
  • After getting the response an email has been sent to the registered email id we need to verify this otherwise our verification will not change in the database. You can see the emailVerificationStatus in the following DB SS. img
  • Go to registred email id inbox and verify the mail then emailVerificationStatus will change to 1. img img img

2. Login with user credentials that we have just created

  • First we need access token to login. URL to get access token is http://localhost:8080/mobile-app-ws/api/authentication . Following is the username and password in the form of JSON payload.This request will save half access token in the database and half will return as a response to the user and will store it in ios keychain if we are using this web service in ios application.
{
    "userName" : "[email protected]",
    "userPassword" : "password"
}
  • Https response with access token
{
    "id": "XAmzmIfnvrTlfudz3LqigwjD0Yu5w3",
    "token": "9UFKFy5Wiw0W8nMB2cLuA="
}
  • Now we can login by using created id and access token. We will pass the created id as path parameter and token as the Bearer Token in postman header. img

3. Update user details

4. Get a unique user

5. Get list of users by Query Parameter

[
    {
        "email": "[email protected]",
        "firstName": "Sultan",
        "href": "/users/user/XAmzmIfnvrTlfudz3LqigwjD0Yu5w3",
        "lastName": "Singh",
        "userId": "XAmzmIfnvrTlfudz3LqigwjD0Yu5w3"
    },
    {
        "email": "[email protected]",
        "firstName": "Sharukh",
        "href": "/users/user/5CWRDZtst0dshgnz1AvV12gqx72KBl",
        "lastName": "Khan",
        "userId": "5CWRDZtst0dshgnz1AvV12gqx72KBl"
    }
]

img

signin-signup-api-using-jakartaee's People

Contributors

sarfaraz-hussain avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.