RestApi Access Problem

When i try to access the Rest Api from postman then i got the html of login i even permit the enpoint of api
@RestController
@RequestMapping("/api/Student")
@CrossOrigin(origins = "http://localhost:3000")
public class RestApplication {

@Autowired
private StudentDetailsService detailsService;
@Autowired
private BookDetailsRepository booksRepositrory;

//// Get All The Students

@GetMapping("/getAllStudents")
public ResponseEntity<List<StudentDetails>> getAllStudents() {
Iterable<StudentDetails> studentDetailsIt = detailsService.getAllStudent();
List<StudentDetails> studentDetails = new ArrayList<StudentDetails>();
studentDetailsIt.forEach(studentDetails::add);

if (studentDetails.isEmpty()) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(studentDetails, HttpStatus.OK);

}
@RestController
@RequestMapping("/api/Student")
@CrossOrigin(origins = "http://localhost:3000")
public class RestApplication {

@Autowired
private StudentDetailsService detailsService;
@Autowired
private BookDetailsRepository booksRepositrory;

//// Get All The Students

@GetMapping("/getAllStudents")
public ResponseEntity<List<StudentDetails>> getAllStudents() {
Iterable<StudentDetails> studentDetailsIt = detailsService.getAllStudent();
List<StudentDetails> studentDetails = new ArrayList<StudentDetails>();
studentDetailsIt.forEach(studentDetails::add);

if (studentDetails.isEmpty()) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(studentDetails, HttpStatus.OK);

}
Security
SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
httpSecurity.csrf(csrf -> csrf.disable())
.authorizeHttpRequests(auth -> auth
.requestMatchers("/", "/signup", "/processRegister", "/Login", "/login", "/forgot-password/**",
"/css/emailVerification.css", "/css/newpassword.css", "css/home.css",
"/css/otpchecker.css", "/css/signup.css", "/css/login.css", "/css/resetpassword.css",
"/api/Student/**")
SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
httpSecurity.csrf(csrf -> csrf.disable())
.authorizeHttpRequests(auth -> auth
.requestMatchers("/", "/signup", "/processRegister", "/Login", "/login", "/forgot-password/**",
"/css/emailVerification.css", "/css/newpassword.css", "css/home.css",
"/css/otpchecker.css", "/css/signup.css", "/css/login.css", "/css/resetpassword.css",
"/api/Student/**")
```
3 Replies
JavaBot
JavaBot5mo ago
This post has been reserved for your question.
Hey @Danix! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Peter Rader
Peter Rader5mo ago
You use postman to request a list of students. Do you send a cookie in postman?
JavaBot
JavaBot5mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server