Code Monkey home page Code Monkey logo

Comments (4)

jan-tennert avatar jan-tennert commented on June 12, 2024 1

Yea, once we found a solution for this we definitely have to clean up the code a little bit

from supabase-kt.

jan-tennert avatar jan-tennert commented on June 12, 2024

Okay so points 1, 2, 4, 5 are normal. I'm not sure why the server client id property even exists as it's not used anyway, but I think its not needed. For point 6 I'm not sure, @temk0 implemented this, so maybe he can help with this. The authorization controller method is a little bit below the composable, are any of those functions implemented called at all? In any case, I'm gonna mark as help needed, as I can't test it myself.

from supabase-kt.

Vaibhav-214 avatar Vaibhav-214 commented on June 12, 2024

I had put some print statements in both the authorization controller methods (different parameters) but they never got executed.

Also I think code never reached to a point where it would execute this signInWithApple() method as it is called inside authorization controller method but shouldn't it be AppleLoginConfig in line 108 instead of GoogleLoginConfig

internal suspend fun ComposeAuth.signInWithApple(idToken: String) {
val config = config.loginConfig["apple"] as? GoogleLoginConfig
supabaseClient.auth.signInWith(IDToken) {
provider = Apple
this.idToken = idToken
nonce = config?.nonce
data = config?.extraData
}
}

AppleLoginConfig is defined here

data class AppleLoginConfig(
override val serverClientId: String = "",
val nonce: String? = null,
var extraData: JsonObject? = null
) : LoginConfig

from supabase-kt.

Vaibhav-214 avatar Vaibhav-214 commented on June 12, 2024

udpate: The control flow is going inside the authorizationController method but the two methods inside it are not executing

internal fun ComposeAuth.authorizationController(
scope:CoroutineScope,
onResult: (NativeSignInResult) -> Unit
): ASAuthorizationControllerDelegateProtocol {
return object : NSObject(), ASAuthorizationControllerDelegateProtocol {
override fun authorizationController(
controller: ASAuthorizationController,
didCompleteWithAuthorization: ASAuthorization
) {
try {
val credentials =
didCompleteWithAuthorization.credential as? ASAuthorizationAppleIDCredential
credentials?.identityToken?.base64EncodedStringWithOptions(
NSUTF8StringEncoding
)?.let { idToken ->
scope.launch {
signInWithApple(idToken)
onResult.invoke(NativeSignInResult.Success)
}
}
} catch (e: Exception) {
onResult.invoke(NativeSignInResult.Error(e.message ?: "error"))
}
}
override fun authorizationController(
controller: ASAuthorizationController,
didCompleteWithError: NSError
) {
when (didCompleteWithError.code.toUInt()) {
1001.toUInt() -> onResult.invoke(NativeSignInResult.ClosedByUser)
else -> onResult.invoke(NativeSignInResult.Error(didCompleteWithError.localizedDescription))
}
}
}
}

Here any of the two methods one at line 82 and another at line 102 is never executed throughout the process, I added print statments at the top and before the return statement by declaring the object as variable , it is printing all the statments that are outside the object methods and returning the delegate object too.But probably those methods are not triggered when they should be

from supabase-kt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.