Initializer

init(clientID:authorizationEndpoint:tokenEndpoint:keychain:scopes:)

Initializes a DeviceAuthorizationFlow object, with scopes.

Declaration

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

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.

scopes

The scopes you want your app to be authorized for, separated by spaces.

Discussion

This initializer calls init(clientID:authorizationEndpoint:tokenEndpoint:keychain:), and initializes the scopes property.

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(
   ...
   // The same as the other initializer.
   ...
   scopes: "read-email-address modify-account"
)

See Also