Skip to content

Commit

Permalink
🐛fix: fix cors
Browse files Browse the repository at this point in the history
  • Loading branch information
Quantaphocpython committed Nov 9, 2024
1 parent 06c6f63 commit b32e18b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ JwtAuthenticationConverter jwtAuthenticationConverter() {
@Bean
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(List.of("*"));
configuration.setAllowedOrigins(List.of("https://wemeet-client.vercel.app/", "http://localhost:3000"));

configuration.setAllowedMethods(List.of("*"));
configuration.setAllowedHeaders(List.of("*"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.videocall.server.service.implement;

import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

import com.videocall.server.config.JwtTokenProvider;
Expand All @@ -25,9 +26,11 @@ public class UserServiceImp implements UserService {
UserRepository userRepository;
UserMapper userMapper;
JwtTokenProvider jwtTokenProvider;
PasswordEncoder passwordEncoder;

@Override
public AuthenticationResponse register(UserCreationRequest request) {
request.setPassword(passwordEncoder.encode(request.getPassword()));
User user = userRepository.save(userMapper.toUser(request));
return AuthenticationResponse.builder()
.accessToken(jwtTokenProvider.generateAccessToken(user))
Expand Down

0 comments on commit b32e18b

Please sign in to comment.