Skip to content

Commit

Permalink
Tweak errors, add public OAuthLogin init
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Jun 16, 2021
1 parent 10ca620 commit 68e1410
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Sources/OAuthenticator/OAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public struct OAuthLogin: Codable {
public var accessToken: Token
public var refreshToken: Token?
public var validUntilDate: Date

public init(accessToken: OAuthLogin.Token, refreshToken: OAuthLogin.Token? = nil, validUntilDate: Date) {
self.accessToken = accessToken
self.refreshToken = refreshToken
self.validUntilDate = validUntilDate
}
}

struct LoginResponse: Decodable {
Expand Down Expand Up @@ -65,11 +71,10 @@ struct LoginResponse: Decodable {
public enum OAuthenticatorError: Error {
case missingResponseComponents
case callbackURLInvalid
case unableToSerializeLoginData
case unableToDeserializeLoginData
case unableToStoreLoginData
case unableToRetrieveLoginData
case refreshTokenUnavailable
case unableToConstructURL
case refreshRetryNotSupported
case loginAfterRefreshNeededNotSupported
}

Expand Down

0 comments on commit 68e1410

Please sign in to comment.