Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add client header #321

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import io.newm.shared.internal.api.models.ResetPasswordException
import io.newm.shared.internal.api.models.ResetPasswordRequest
import io.newm.shared.internal.api.utils.addHumanVerificationCodeToHeader
import io.newm.shared.public.models.error.KMMException
import shared.getPlatformName


internal class LoginAPI(
Expand Down Expand Up @@ -63,6 +64,7 @@ internal class LoginAPI(
contentType(ContentType.Application.Json)
setBody(user)
addHumanVerificationCodeToHeader(humanVerificationCode)
parameter("clientPlatform", getPlatformName())
}
when (response.status) {
HttpStatusCode.OK -> {}
Expand All @@ -85,6 +87,7 @@ internal class LoginAPI(
contentType(ContentType.Application.Json)
setBody(user)
addHumanVerificationCodeToHeader(humanVerificationCode)
parameter("clientPlatform", getPlatformName())
}.body<LoginResponse>()

suspend fun loginWithGoogle(
Expand All @@ -95,6 +98,7 @@ internal class LoginAPI(
contentType(ContentType.Application.Json)
setBody(request)
addHumanVerificationCodeToHeader(humanVerificationCode)
parameter("clientPlatform", getPlatformName())
}

return when (response.status) {
Expand All @@ -113,6 +117,7 @@ internal class LoginAPI(
contentType(ContentType.Application.Json)
setBody(request)
addHumanVerificationCodeToHeader(humanVerificationCode)
parameter("clientPlatform", getPlatformName())
}

return when (response.status) {
Expand All @@ -127,6 +132,7 @@ internal class LoginAPI(
val response = httpClient.post("/v1/auth/login/facebook") {
contentType(ContentType.Application.Json)
setBody(request)
parameter("clientPlatform", getPlatformName())
}

return when (response.status) {
Expand All @@ -141,6 +147,7 @@ internal class LoginAPI(
val response = httpClient.post("/v1/auth/login/linkedin") {
contentType(ContentType.Application.Json)
setBody(request)
parameter("clientPlatform", getPlatformName())
}

return when (response.status) {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/iosMain/kotlin/shared/actual.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ actual fun platformModule() = module {
single<TokenManager> { TokenManagerImpl(get(), get()) }
}

actual fun getPlatformName(): String = "iOS"
actual fun getPlatformName(): String = "IOS"
Loading