Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 在iOS 11和iOS 12上注销后出现ASWebAuthentication和SFAuthentication登录问题,无法使会话无效_Swift_Authentication_Oauth 2.0_Sfauthenticationsession_Aswebauthenticationsession - Fatal编程技术网

Swift 在iOS 11和iOS 12上注销后出现ASWebAuthentication和SFAuthentication登录问题,无法使会话无效

Swift 在iOS 11和iOS 12上注销后出现ASWebAuthentication和SFAuthentication登录问题,无法使会话无效,swift,authentication,oauth-2.0,sfauthenticationsession,aswebauthenticationsession,Swift,Authentication,Oauth 2.0,Sfauthenticationsession,Aswebauthenticationsession,我正在使用ASWebAuthentication和SFAuthentication在OAuth2服务器上使用grant\u type:authentication\u code进行身份验证 除了以下各项外,一切都很完美: 用户登录成功 通过注销访问令牌和状态代码为200的刷新令牌注销 测试撤销是否有效 print("Auth-Login : Process: Authenticate user") let state = String().createState(length: 4)

我正在使用
ASWebAuthentication和SFAuthentication
在OAuth2服务器上使用
grant\u type:authentication\u code
进行身份验证

除了以下各项外,一切都很完美:

  • 用户登录成功
  • 通过
    注销访问令牌和状态代码为200的刷新令牌注销
  • 测试撤销是否有效
     print("Auth-Login : Process: Authenticate user")
        let state = String().createState(length: 4)
        let codeVerifier = String().createCodeVerifier()
        let codeChallenge = codeVerifier.pkceEncode.base64UriEncode
        let parameters = ["state=\(state)", "code_challenge=\(codeChallenge)"]
        let url = createUrl(parameters: parameters)
        guard let authURL = url else { return }
        DispatchQueue.main.async {
            self.delegate?.removeLoader()
            if #available(iOS 12.0, *) {
                print("Auth-Login : Process: Run ASWebAuthenticationSession")
    
                self.webAuthSession = ASWebAuthenticationSession(url: authURL, callbackURLScheme: "no.bilkollektivet.app") { (callbackUrl, error) in
                    print(callbackUrl)
                    if let error = error {
                        completionHandler(nil, nil, error)
                    } else {
                        let result = self.getCodeFromCallbackUrl(url: callbackUrl, state: state)
                        completionHandler(result.code, codeVerifier, result.error)
                    }
                }
                if #available(iOS 13.0, *) {
                    self.webAuthSession.presentationContextProvider = self
                    self.webAuthSession.prefersEphemeralWebBrowserSession = true
                }
    
                self.webAuthSession.start()
            } else {
                print("Auth-Login : Process: Run SFAuthenticationSession")
    
                self.sfAuthSession = SFAuthenticationSession(url: authURL, callbackURLScheme: "no.bilkollektivet.app") { (callbackUrl, error) in
                    if let error = error {
                        completionHandler(nil, nil, error)
                    } else {
                        let result = self.getCodeFromCallbackUrl(url: callbackUrl, state: state)
                        completionHandler(result.code, codeVerifier, result.error)
                    }
                }
    
                self.sfAuthSession.start()
            }
        }