         auth.requestedScopes = command.argument(at: 3) as! Array
         
         let svc = SFSafariViewController(url: auth.spotifyWebAuthenticationURL())
+        svc.delegate = self;
+        svc.modalPresentationStyle = .overFullScreen
+        
         var observer: NSObjectProtocol?
         observer = NotificationCenter.default.addObserver(
             forName: NSNotification.Name.CDVPluginHandleOpenURL,

            
            svc.presentingViewController!.dismiss(animated: true, completion: nil)
            NotificationCenter.default.removeObserver(observer!)
            
            auth.handleAuthCallback(withTriggeredAuthURL: url) { (err, sess) in
                guard err == nil else {

import Foundation
import SafariServices

@objc(SpotifyOAuthPlugin) class SpotifyOAuthPlugin: CDVPlugin, SFSafariViewControllerDelegate {
    private var currentCommand: CDVInvokedUrlCommand?
    private var currentNsObserver: AnyObject?
    
    func authorize(_ command: CDVInvokedUrlCommand) {
        let auth = SPTAuth.defaultInstance()!
        
