jvm-js-fullstack
jvm-js-fullstack copied to clipboard
POST request returns 403 error on deployed app
I've followed this tutorial to build a KMM app. Everything works fine when the app is running on the local server but the POST method returns Error 403 when deployed on Heroku. This is the function on the Client side.
val endpoint = window.location.origin // only needed until https://github.com/ktorio/ktor/issues/1695 is resolved
val jsonClient = HttpClient { install(JsonFeature) { serializer = KotlinxSerializer() } }
suspend fun sendfeedback(userinfo: UserInfo) {
jsonClient.post<Unit>(endpoint + UserInfo.path) {
contentType(ContentType.Application.Json)
body = userinfo
}
}
See: https://youtrack.jetbrains.com/issue/KTOR-4008/POST-request-to-database-returns-403-error#focus=Comments-27-6434385.0-0