authenticateUser(clientId_redirectUri_scope_presentationContextProvider_) - daneden/Twift GitHub Wiki

authenticateUser(clientId:redirectUri:scope:presentationContextProvider:)

Authenticates the user using Twitter's OAuth 2.0 PKCE flow.

@_disfavoredOverload
  @available(*, deprecated, message: "Use throwing 'authenticateUser' function instead")
  public func authenticateUser(clientId: String,
                               redirectUri: URL,
                               scope: Set<OAuth2Scope>,
                               presentationContextProvider: ASWebAuthenticationPresentationContextProviding? = nil
  )

Parameters

  • clientId: The client ID for your Twitter API app
  • redirectUri: The URI to redirect users to after completing authentication.
  • scope: The user access scopes for your authentication. For automatic token refreshing, ensure that offlineAccess is included in the scope.
  • presentationContextProvider: Optional presentation context provider. When not provided, this function will handle the presentation context itself.

Returns

A tuple containing the authenticated user access tokens or any encoutered error.

authenticateUser(clientId:redirectUri:scope:presentationContextProvider:)

Authenticates the user using Twitter's OAuth 2.0 PKCE flow.

@MainActor
  public func authenticateUser(clientId: String,
                               redirectUri: URL,
                               scope: Set<OAuth2Scope>,
                               presentationContextProvider: ASWebAuthenticationPresentationContextProviding? = nil
  )

Parameters

  • clientId: The client ID for your Twitter API app
  • redirectUri: The URI to redirect users to after completing authentication.
  • scope: The user access scopes for your authentication. For automatic token refreshing, ensure that offlineAccess is included in the scope.
  • presentationContextProvider: Optional presentation context provider. When not provided, this function will handle the presentation context itself.

Returns

The authenticated user access tokens.