AuthenticationMethodOAuth2

public final class AuthenticationMethodOAuth2 : AuthenticationSingleStepMethod

A method that delegates authentication of the current user to a third-party identity provider, based on the OAuth 2.0 standard.

The user interaction with the provider is isolated from the rest of the application. It uses ASWebAuthenticationSession.

Stored Properties

  • The provider.

    Declaration

    Swift

    public let oAuth2Provider: AuthenticationProvider.OAuth2Family
  • The scope requested to the OAuth 2.0 provider.

    When nil, a default minimal scope depending on the provider is used.

    Declaration

    Swift

    public var scope: String?
  • The options passed to the OAuth 2.0 provider.

    The following keys of this dictionary are ignored: mode, scope and to.

    Declaration

    Swift

    public var options: [String : Any]

Initializers

  • Creates a new instance.

    To make a UIViewControllersubclass conform to the ASWebAuthenticationPresentationContextProviding protocol, you can simply add the following method in its definition:

    func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
        view.window ?? ASPresentationAnchor()
    }
    

    Declaration

    Swift

    public convenience init(provider: AuthenticationProvider.OAuth2Family, presentationContextProvider: ASWebAuthenticationPresentationContextProviding, file: StaticString = #fileID, line: UInt = #line)

    Parameters

    provider

    The OAuth 2.0 provider to user.

    presentationContextProvider

    A delegate that provides a display context in which the system can present an authentication session to the user.

    file

    The file from which the method is called. This is used for debugging purposes.

    line

    The line from which the method is called. This is used for debugging purposes.

AuthenticationMethod Protocol

CustomDebugStringConvertible Protocol

  • Declaration

    Swift

    public var debugDescription: String { get }