Initializer

init(clientID:authorizationEndpoint:tokenEndpoint:keychain:)

Initializes a DeviceAuthorizationFlow object.

Declaration

init(clientID: String, authorizationEndpoint: URL, tokenEndpoint: URL, keychain: Keychain)

Parameters

clientID

The client identifier issued by the server.

authorizationEndpoint

The server authorization endpoint URL.

tokenEndpoint

The server token endpoint URL.

Keychain

An instance of Keychain from KeychainAccess. Full KeychainAccess documentation.

Discussion

This initializer is called by init(clientID:authorizationEndpoint:tokenEndpoint:keychain:scopes:).

Example Code:


// the "accessGroup" parameter is only necessary if you wish to share the keychain across
// multiple targets using a keychain sharing entitlement
let keychain = Keychain(service: "your.app.bundleID", accessGroup: "appIdentifierPrefix.your.app.bundleID")
   .label("Your App Name")


let domain = DeviceAuthorizationFlow(
   clientID: "9d73bfb50b304543b35f41d427e6b76c",
   authorizationEndpoint: URL(string: "https://domain.com/authorize")!,
   tokenEndpoint: URL(string: "https://domain.com/token")!,
   keychain: keychain
)

See Also