ios – Methods to show login web page throughout auth request

[ad_1]

I’m attempting to show the login web page of Coinbase throughout auth request . How can I exploit the AppAuth library operate to show the login menu in Coinbase? It reveals for a short seconds, then disappears.

import AppAuth

class CoinbaseViewController: UIViewController {
  
  var appDelegate: AppDelegate?
  
  override func viewDidLoad() {
    tremendous.viewDidLoad()
      
    view.backgroundColor = .clear
    
    self.performRequest()
  }
  
  // MARK: - Capabilities
  
  personal func performRequest() {
    let authorizationEndpoint = URL(string: "")!
    let tokenEndpoint = URL(string: "https://www.coinbase.com/oauth/token?client_id=")!
    let redirectURI = URL(string: "")!
    
    let clientID = ""
    let clientSecret = ""
    
    let configuration = OIDServiceConfiguration(authorizationEndpoint: authorizationEndpoint, tokenEndpoint: tokenEndpoint)
    
    // builds authentication request
    let request = OIDAuthorizationRequest(configuration: configuration,
                                          clientId: clientID,
                                          clientSecret: clientSecret,
                                          scopes: [OIDScopeOpenID, OIDScopeProfile],
                                          redirectURL: redirectURI,
                                          responseType: OIDResponseTypeCode,
                                          additionalParameters: nil)
    
    // performs authentication request
    print("Initiating authorization request with scope: (request.scope ?? "nil")")
    
    guard let appDelegate = appDelegate else { return }
    appDelegate.currentAuthorizationFlow =
    OIDAuthState.authState(byPresenting: request, presenting: self) { authState, error in
      if let authState = authState {
        // self.setAuthState(authState)
        print("Acquired authorization tokens. Entry token: " +
              "(authState.lastTokenResponse?.accessToken ?? "nil")")
      } else {
        print("Authorization error: (error?.localizedDescription ?? "Unknown error")")
        // self.setAuthState(nil)
      }
    }

[ad_2]

Leave a Reply