Twift_Authentication - daneden/Twift GitHub Wiki
Twift.Authentication
A convenience class for acquiring user access token
public class Authentication: NSObject, ASWebAuthenticationPresentationContextProviding
Inheritance
ASWebAuthenticationPresentationContextProviding
, NSObject
Methods
requestUserCredentials(clientCredentials:callbackURL:presentationContextProvider:with:)
Request user credentials by presenting Twitter's web-based authentication flow
@available(*, deprecated, message: "OAuth 1.0a authentication will be removed in a future stable version of Twift. Use the `Authentication.authenticateUser` method for OAuth 2.0 authentication instead.")
public func requestUserCredentials(
clientCredentials: OAuthCredentials,
callbackURL: URL,
presentationContextProvider: ASWebAuthenticationPresentationContextProviding? = nil,
with completion: @escaping ((userCredentials: OAuthCredentials?, error: Error?)) -> Void
)
Parameters
- presentationContextProvider: Optional presentation context provider. When not provided, this function will handle the presentation context itself.
- callbackURL: The callback URL as configured in your Twitter application settings
- completion: A callback that allows the caller to handle subsequent user credentials or errors. Callers are responsible for storing the user credentials for later use.
presentationAnchor(for:)
public func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor