From 68e1410b8889b230b6f5484211017d4b3ad4adfa Mon Sep 17 00:00:00 2001 From: Matt <85322+mattmassicotte@users.noreply.github.com> Date: Wed, 16 Jun 2021 13:55:03 -0400 Subject: [PATCH] Tweak errors, add public OAuthLogin init --- Sources/OAuthenticator/OAuthenticator.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Sources/OAuthenticator/OAuthenticator.swift b/Sources/OAuthenticator/OAuthenticator.swift index 76e229f..37412a4 100644 --- a/Sources/OAuthenticator/OAuthenticator.swift +++ b/Sources/OAuthenticator/OAuthenticator.swift @@ -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 { @@ -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 }