jvm-js-fullstack icon indicating copy to clipboard operation
jvm-js-fullstack copied to clipboard

POST request returns 403 error on deployed app

Open jpcurbelo opened this issue 2 years ago • 1 comments

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
}

}

jpcurbelo avatar Aug 12 '22 20:08 jpcurbelo

See: https://youtrack.jetbrains.com/issue/KTOR-4008/POST-request-to-database-returns-403-error#focus=Comments-27-6434385.0-0

racka98 avatar Sep 07 '22 18:09 racka98