Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 1.01 KB

README.md

File metadata and controls

32 lines (24 loc) · 1.01 KB

LinkedInAuthenticator

Auth provider for social login with LinkedIn.

Setup

Please read official documentation from LinkedIn for the details about the authorization.

Usage

// present login screen
body
  .sheet(isPresented: $openLinkedInWebView) {
    LinkedInWebView(with: linkedInConfig) { data in
      Task { await viewModel.signInWithLinkedIn(authCode: data.code) }
    } onFailure: {
      viewModel.error = .general
    }
  }

// handle response from webView
let authResponse = try await auth.signIn(authCode: authCode, configuration: linkedInConfig)

// get authentication status
let state = authenticator.isAuthenticated

// signOut user
authenticator.signOut() // all provider data regarding the use auth is cleared at this point

// handle url
authenticator.canOpenUrl(_: application: options:) // call this from `application:openURL:options:` in UIApplicationDelegate