OidcClient
public class OidcClient
Class representing an OpenID Connect client.
- Property pkce: PKCE object used for the Authorization call.
-
Declaration
Swift
public var pkce: Pkce?
-
OidcClient initializer.
Declaration
Swift
public init(config: OidcClientConfig)
Parameters
config
The configuration for this client.
-
OidcClient generateAuthorizeUrl.
Declaration
Swift
public func generateAuthorizeUrl(customParams: [String : String]? = nil) throws -> URL
Parameters
customParams
Custom parameters to include in the authorization request.
-
extractCodeAndGetToken(from:
Asynchronous) Extracts the code from the URL and exchanges it for an access token.
Declaration
Swift
public func extractCodeAndGetToken(from url: URL) async throws -> Token
Parameters
url
The URL to extract the code from.
-
Extract the Redirect URI scheme from the configuration
Declaration
Swift
public func redirectURIScheme() -> String?
-
token()
AsynchronousRetrieves an access token. If a cached token is available and not expired, it is returned. Otherwise, a new token is fetched with refresh token if refresh grant is available.
Return Value
A Result containing the access token or an error.
-
refreshToken(_:
Asynchronous) Refreshes the access token.
Declaration
Swift
public func refreshToken(_ refreshToken: String) async throws -> Token
Parameters
refreshToken
The refresh token to use for refreshing the access token.
Return Value
The refreshed access token.
-
revoke()
AsynchronousRevokes the access token.
Declaration
Swift
public func revoke() async
-
endSession()
AsynchronousEnds the session. Best effort to end the session. The stored token is removed regardless of the result.
Declaration
Swift
@discardableResult public func endSession() async -> Bool
Return Value
A boolean indicating whether the session was ended successfully.
-
endSession(signOff:
Asynchronous) Ends the session with a custom sign-off procedure.
Declaration
Swift
@discardableResult public func endSession(signOff: @escaping (String) async throws -> Bool) async -> Bool
Parameters
signOff
A suspend function to perform the sign-off.
Return Value
A boolean indicating whether the session was ended successfully.
-
userinfo()
Asynchronous -
Represents various constants used in OIDC requests
See moreDeclaration
Swift
public enum Constants