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

Make sure we do not send stale tokens on iOS #289

Merged
merged 1 commit into from
Apr 19, 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
@@ -0,0 +1,7 @@
package fr.androidmakers.store.graphql

import fr.androidmakers.domain.repo.UserRepository

actual suspend fun getIdToken(userRepository: UserRepository): String? {
return userRepository.getIdToken()
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import com.apollographql.apollo3.network.http.HttpInterceptor
import com.apollographql.apollo3.network.http.HttpInterceptorChain
import fr.androidmakers.domain.repo.UserRepository

expect suspend fun getIdToken(userRepository: UserRepository): String?

fun ApolloClient(
sqlNormalizedCacheFactory: SqlNormalizedCacheFactory,
userRepository: UserRepository,
Expand All @@ -25,7 +27,7 @@ fun ApolloClient(
/**
*
*/
val token = userRepository.getIdToken()
val token = getIdToken(userRepository)
if (token != null) {
addHeader("Authorization", "Bearer $token")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package fr.androidmakers.store.graphql

import fr.androidmakers.domain.repo.UserRepository

actual suspend fun getIdToken(userRepository: UserRepository): String? {
// We do not support signin on iOS? make sure that we're not sending a stale token
return null
}
Loading