OAuth Flow in IOS always redirects me to twitch.tv

As title says.
I login, build the url and loading it a safariviewcontroller. The authorization screen of the app doesn’t appear, instead it makes me login in twitch and then BOM! It redirects me to the twitch.tv homepage lol
This is my code to provide the URL.
static public let shared = TwitchAPI()

static let clientID = “XXXX”
static let secretKey = “XXXX”
static let redirectURL = “XXX”
static let scopes = “user_subscriptions”

static let baseURL = “https://api.twitch.tv/” /I’ll use this URL for every NON OAUTH Request./
static let oauthURL = “https://id.twitch.tv/oauth2” /The OAuth2 endpoint’ll be used during the authentication flow./
public var loginURL: URL = {
var urlComponents = URLComponents(string: “(TwitchAPI.oauthURL)/authorize” )!

urlComponents.queryItems = [
    URLQueryItem(name: "client_id", value: TwitchAPI.clientID),
    URLQueryItem(name: "redirect_uri", value: TwitchAPI.redirectURL),
    URLQueryItem(name: "response_type", value: "code"),
    URLQueryItem(name: "scope", value: "viewing_activity_read")

let url = urlComponents.url
return url!