Skip to content

Commit 5007161

Browse files
authored
Update README.md
1 parent 0173556 commit 5007161

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

README.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ Follow the steps below to run the application:
8686
* (my mysql database is authentication_system , so create only database with any name as per your requirement)
8787
* Run the application using Intellij IDE.
8888

89-
* This is my application.properties
89+
* This is my application.properties
90+
```http
9091
* #Database Configuration
9192
* spring.datasource.url=jdbc:mysql://localhost:3306/authentication_system <---Add your database name only
9293
@@ -107,7 +108,7 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
107108
app.jwt-secret=JWTSecretKey
108109
app.jwt-expiration-milliseconds=604800000
109110
110-
111+
```
111112

112113

113114
# Usage
@@ -121,16 +122,17 @@ You can interact with the API endpoints using Postman or any other API testing t
121122
* Method POST: http://localhost:8080/api/auth/register
122123
Select --> Body --> raw --> JSON
123124
Request Body:
124-
125+
```http
125126
* JSON Structure
126127
{
127128
"username": "woromedia_1",
128129
"password": "password123",
129130
"email": "woromedia_1@example.com"
130131
}
132+
```
131133
click on ---> Send
132134
* Response: HTTP 200 OK with "User registered successfully" message.
133-
*
135+
134136
![User_register](https://github.com/SDEParag/Java-backend-Spring-boot-MySQL-login-logout-Authentication-System/assets/137553676/9f503ac4-834d-409e-ad7c-01bcd9c40558)
135137

136138
* Bad Credentials: If the provided username or email is already taken,
@@ -142,42 +144,47 @@ the endpoint returns HTTP 400 Bad Request with an appropriate error message.
142144

143145

144146
* 2 User Login Endpoint:
147+
145148
URL:
146149
* Method POST: http://localhost:8080/api/auth/login
147150
Select --> Body --> raw --> JSON
148151
Request Body:
152+
```http
149153
* JSON Structure
150154
{
151155
"usernameOrEmail": "woromediaintern_1",
152156
"password": "password123"
153157
}
154-
158+
```
155159
* Response: HTTP 200 OK with a JWT token in the response body.
156160

157161
![login](https://github.com/SDEParag/Java-backend-Spring-boot-MySQL-login-logout-Authentication-System/assets/137553676/c17d8308-a24b-4d27-af94-39571bd7d8df)
158162

159163
* JWT token (On successful login):
164+
```http
160165
{
161166
"token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ3b3JvbWVkaWFfMUBleGFtcGxlLmNvb
162167
SIsImlhdCI6MTY5MTcwOTA0NywiZXhwIjoxNjkyMzEzODQ3fQ.d4GRTnppSYzlONRFleCqRbRgi7WsJe_fxv6Ui
163168
EOpfl9h5sr5FG5D3EQ9IdkKGNxZVKnNbKTU-hZi_bPtRMtafg",
164169
"tokenType": "Bearer"
165170
}
166-
}
167-
171+
```
168172
* Bad Credentials: If the provided username or email and password combination is invalid, the endpoint returns HTTP 401 Unauthorized with an error message.
169173

170174
![wrong input password or username](https://github.com/SDEParag/Java-backend-Spring-boot-MySQL-login-logout-Authentication-System/assets/137553676/139656f1-a667-4ad8-8817-49c04fbe48ae)
171175

172-
* 3 Admin Panel Endpoint:
173176

177+
* 3 Admin Panel Endpoint:
178+
```http
174179
URL:
175180
* Method GET : http://localhost:8080/api/auth/admin
176181
177182
* Select --> Authorization --> Bearer token --> copy login token paste in Token like below,
178-
Token: [ eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ3b3JvbWVkaWFfMUBleGFtcGxlLmNvb
179-
SIsImlhdCI6MTY5MTcwOTA0NywiZXhwIjoxNjkyMzEzODQ3fQ.d4GRTnppSYzlONRFleCqRbRgi7WsJe_fxv6Ui
180-
EOpfl9h5sr5FG5D3EQ9IdkKGNxZVKnNbKTU-hZi_bPtRMtafg ]
183+
184+
Token:
185+
[eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ3b3JvbWVkaWFfMUBleGFtcGxlLmNvbSIsImlhdCI6MTY5MTcwOTA0NywiZXhwI
186+
joxNjkyMzEzODQ3fQ.d4GRTnppSYzlONRFleCqRbRgi7WsJe_fxv6UiEOpfl9h5sr5FG5D3EQ9IdkKGNxZVKnNbKTU-hZi_bPtRMtafg]
187+
```
181188

182189
Click on Send
183190
* Response: HTTP 200 OK with "Admin Panel" message.

0 commit comments

Comments
 (0)