IDKit
public class IDKit : IDKitProtocol
Undocumented
-
Sets up IDKit with the passed configuration.
Declaration
Swift
public static func setup(with configuration: OIDConfiguration, cacheSession: Bool = true, presentingViewController: UIViewController? = nil)Parameters
configurationThe current
OIDConfiguration.cacheSessionIf set to
truethe session will be persisted by IDKit to improve the chance of not having to resign in again. Defaults totrue.presentingViewControllerlThe view controller to present the authorization’s view on. Can be passed at a later point in time.
-
Swaps the current presenting view controller with a new one without having to call
setup(with configuration: OIDConfiguration, presentingViewController: UIViewController? = nil)again.Declaration
Swift
public static func swapPresentingViewController(with newViewController: UIViewController)Parameters
newViewControllerThe new presenting view controller.
-
Performs a discovery to retrieve an OID configuration.
Declaration
Swift
static func discoverConfiguration(issuerUrl: String, _ completion: @escaping ((String?, String?, IDKitError?) -> Void))Parameters
issueUrlThe issuer url.
completionThe block to be called when the discovery is complete either including the
authorizationEndpointandtokenEndpointor anerror.
-
Performs an OID authorization request.
Declaration
Swift
static func authorize(_ completion: @escaping ((String?, IDKitError?) -> Void))Parameters
completionThe block to be called when the request is complete including either a valid
accessTokenor anerror. -
Refreshes the current access token if needed.
Declaration
Swift
static func refreshToken(force: Bool = false, _ completion: @escaping ((String?, IDKitError?) -> Void))Parameters
forceForces a refresh even if the current accessToken is still valid. Defaults to
false.completionThe block to be called when the request is complete including either a new valid
accessTokenor anerror. -
Cancels the authorization flow and invokes the authorize completion block with a
cancellederror. Has no effect when calling multiple times.Declaration
Swift
static func cancelAuthorizationFlow(_ completion: (() -> Void)? = nil)Parameters
completionThe block to be called when the cancellation is complete.
-
Resets the current session.
Declaration
Swift
static func resetSession(_ completion: (() -> Void)? = nil)Parameters
completionThe block to be called when the reset is complete.
-
Checks the current authorization state. Returning
truedoes not mean that the access is fresh - just that it was valid the last time it was used.Declaration
Swift
static func isAuthorizationValid() -> BoolReturn Value
The current state of the authorization.
-
Returns the latest received access token of the current session.
Declaration
Swift
static func latestAccessToken() -> String?Return Value
The latest access token.
-
Retrieves the currently authorized user’s information.
Declaration
Swift
static func userInfo(completion: @escaping (UserInfo?, IDKitError?) -> Void)Parameters
completionThe block to be called when the request is complete including either valid
userInfoor anerror. -
Undocumented
See moreDeclaration
Swift
enum IDKitError : Error, CustomStringConvertible -
Undocumented
See moreDeclaration
Swift
struct OIDConfiguration -
Undocumented
See moreDeclaration
Swift
struct UserInfo : Decodable
View on GitHub
IDKit Class Reference