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

Not getting the auth callback iOS #24

Open
alejandrorbradford opened this issue Mar 13, 2024 · 0 comments
Open

Not getting the auth callback iOS #24

alejandrorbradford opened this issue Mar 13, 2024 · 0 comments

Comments

@alejandrorbradford
Copy link

alejandrorbradford commented Mar 13, 2024

On iOS it seems the callback is never called and it seems it's an issue directly with the swift/objc implementation

        request.send(self, completion: { resp in
            guard let strongSelf = weakSelf else { return }
            
            // STEP 3: Parse and handle the response
            if resp.errCode.rawValue == 0 {
                let responseCode = resp.code
                // Upload response code to your server and obtain user access token
                // ...
            } else {
                // User authorization failed. Handle errors
                // ...
            }
        })

It never gets to the guard let strongSelf... line.

Complete code

 @objc
 func auth(_ callback: @escaping RCTResponseSenderBlock) {
        // STEP 1: Create the request and set permissions
        let scopes = ["user.info.basic,video.list"] // list your scopes
        let scopesSet = NSOrderedSet(array: scopes)
        let request = TikTokOpenSDKAuthRequest()
        request.permissions = scopesSet

        // STEP 2: Send the request
        weak var weakSelf = self
        request.send(self, completion: { resp in
            guard let strongSelf = weakSelf else { return }
            
            // STEP 3: Parse and handle the response
            if resp.errCode.rawValue == 0 {
                let responseCode = resp.code
                // Upload response code to your server and obtain user access token
                // ...
            } else {
                // User authorization failed. Handle errors
                // ...
            }
        })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant