카카오로그인을 장고로 백엔드를 구현하고 플러터로 프론트를 구현해서 연동시키려는데 에러가 떴다.
에러메시지
localhost refused to connect
Flutter 앱 자체에서 로그인을 하지 않고 모바일 웹에서 로그인한 후 결과를 Redirect URI를 통해 앱으로 리턴받기 위해 작성한 url이 문제였다. 에뮬레이터를 실행시켜서 테스트를 진행하려고 했는데 Android emulator는 127.0.0.1을 localhost로 쓰지 않고 10.0.2.2를 쓰기 때문이다.
그래서 플러터에서 url을 "http://127.0.0.1:8000/user/signin/kakao/", 에서 "http://10.0.2.2:8000/user/signin/kakao/",로 변경하고 장고에서도 redirect url을 10.0.2.2로 변경해주었더니 잘 작동했다. (카카오 콘솔에서도 등록한 redirect url을 변경해주어야 한다.)
why is flutter refusing to connect on localhost:8000 or 127.0.01:8000?
I'm following the Flutter Networking/HTTP tutorial to do a GET request to a server running on my localhost:8000. Visiting my localhost via my browser works fine. This works fine too when I point to...
stackoverflow.com
'Flutter' 카테고리의 다른 글
[Flutter] Container 위젯을 가운데로 정렬하기 (0) | 2022.03.21 |
---|