mironal / TwitterAPIKit

Swift library for the Twitter API v1 and v2 🍷
MIT License
118 stars 23 forks source link

Can not sign in OAuth 2.0 in physical device #149

Open serkanozcan opened 1 year ago

serkanozcan commented 1 year ago

Hi,

I'm having an issue trying to log in with OAuth 2.0 in physical device. It works when native twitter app not installed on device. But if twitter app is installed on device it stucks after entering username and password like this.

IMG_5134

i tried TwitterAPIKit-iOS-sample and same thing happened.

serkanozcan commented 1 year ago

there is a thread in twitter community. They said issue resolved but at my side not resolved.

https://twittercommunity.com/t/login-with-twitter-is-now-broken-on-ios/182126/11

serkanozcan commented 1 year ago

i also opened a new thread

https://twittercommunity.com/t/can-not-sign-in-oauth-2-0-on-a-physical-ios-device-if-twitter-app-installed-on-device/184272

hearther commented 1 year ago

Hi, there

I found way to fix this OAuth2CodeFlowPKCEViewController.swift line 39

let state = "" // Rewrite your state to //random string let state = String( String(repeating: "a", count: 128).compactMap { _ in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".randomElement() } ) then it work!!