static let ClientId = "188766122934-0t21j64fd4qmcomewpho6jeqwxe6kpwq.apps.googleusercontent.com"
static let ClientSecret = "AIza34De1h2JIehyugxcgYnXewtokGdi0xXPsJMTY"
static let ScopeYoutubeReadonly = "https://www.googleapis.com/auth/youtube.readonly"
static let ScopeUserinfoEmail = "https://www.googleapis.com/auth/userinfo.email"
static let ScopeUserinfoProfile = "https://www.googleapis.com/auth/userinfo.profile"
let provider = OAuthGoogle(clientId: ServiceRequest.ClientId, clientSecret: "", scopes: [ServiceRequest.ScopeUserinfoEmail, ServiceRequest.ScopeUserinfoProfile, ServiceRequest.ScopeYoutubeReadonly])
let authenticationViewController = AuthenticationViewController(provider: provider)
authenticationViewController.failureHandler = { error in
print(error)
}
authenticationViewController.authenticationHandler = { token in
print (token)
authenticationViewController.dismiss(animated: true, completion: nil)
}
present(authenticationViewController, animated: true, completion: nil)
Here I share the connector for Google OAuth2 with an usage example (hope its help):
OAuthGoogle.swift