LoginKit isWebAuth = false, but always trying web auth and fail.
Opened this issue · 10 comments
Hello, I'm flutter developer, I'm using android/ios loginkit via method channel.
It's my auth code.
let scopes: Set = [
"user.info.basic",
"user.info.profile",
"user.info.stats",
"video.list"
]
self.authRequest = TikTokAuthRequest(
scopes: scopes,
redirectURI: redirectUri
)
self.authRequest?.isWebAuth = false
self.authRequest?.send { response in
guard let authResponse = response as? TikTokAuthResponse else {
result(FlutterError(
code: "temporarily_unavailable",
message: "Empty Response",
details: nil
))
return
}
if authResponse.errorCode == .noError {
let resultMap: Dictionary<String,String?> = [
"authCode": authResponse.authCode,
"state": authResponse.state,
"grantedPermissions": authResponse.grantedPermissions?.joined(separator: ","),
"codeVerifier": self.authRequest?.pkce.codeVerifier
]
result(resultMap)
} else {
result(FlutterError(
code: String(authResponse.error ?? "-2"),
message: authResponse.errorDescription,
details: nil
))
}
}
my info plist
...
<string>fbshareextension</string>
<string>tiktokopensdk</string>
<string>tiktoksharesdk</string>
<string>snssdk1180</string>
<string>snssdk1233</string>
</array>
<key>TikTokClientKey</key>
<string>...</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>TikTok</string>
<key>CFBundleURLSchemes</key>
<array>
<string>...</string>
</array>
</dict>
authRequest?.isWebAuth = false
- but, my app trying always web auth when installed tiktok app or uninstalled tiktok app.
- and, web auth is fail and cannot go to redirect uri.
my tiktok app status is Live, and correct input redirect uri(it's universal url).
but I saw redirect fail message(formated json) on empty webpage like below:
{
"data": {
"captcha": "",
"dest_url": "",
"description": "Somwthing went wrong. Please try again",
"error_code": 6,
},
"message": "error
}
I failed found that error_code 6
.
what's mean to error_code 6
?
how can I modify myapp for isWebAuth = false working and redirect fail resolve?
please answer me.
thanks, best regard.
Did you find the solution for this @levinyu-TagBy? I have the same error with SDK 2.3.0
Did you find the solution for this @levinyu-TagBy? I have the same error with SDK 2.3.0
Not yet.
urlOpener.isTikTokInstalled() is (null).
why?
@aurelkpr hey, did you added CFBundleURLSchemes?
as-is
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>TikTok</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$my tiktok client key</string>
</array>
</dict>
to-be
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>TikTok</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$my tiktok client key</string>
<string>www.tiktok.com</string>
<string>snssdk1233</string>
<string>snssdk1180</string>
</array>
</dict>
please try this.
I added tiktok auth domain and queries in CFBundleURLSchemes, it's work.(if tiktok app installed, tiktok app launch.)
and, web auth success.(tiktok app not installed),
@levinyu-TagBy thanks for info. For me worked without <string>www.tiktok.com</string>
.
Update. Adding snssdk1233
and snssdk1180
to CFBundleURLSchemes
make the urlOpener.isTikTokInstalled() call to return true all times (even if TikTok app is not installed) :(. With them, the SDK (in case when TikTok is not installed) will redirect to the default device browser which is wrong. It should redirect to in-app browser :(. Still search for the solution ....
@levinyu-TagBy Did it was resolved?
Did it was resolved?
Try this.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>TikTok</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$my tiktok client key</string>
<string>www.tiktok.com</string>
</array>
</dict>
if you guys use to this code, sometimes uses a previously created codeVerifier rather than creating a new codeVerifier.
<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>None</string> <key>CFBundleURLName</key> <string>TikTok</string> <key>CFBundleURLSchemes</key> <array> <string>$my tiktok client key</string> <string>www.tiktok.com</string> <string>snssdk1233</string> <string>snssdk1180</string> </array> </dict>