Protocols
The following protocols are available globally.
-
A protocol that defines common attributes of Google authentication methods.
It is not intended for a user’s type to conform to this protocol directly. Instead, your type should conform to a specific authentication type, such as
See moreTypeSafeGoogleToken
.Declaration
Swift
public protocol TypeSafeGoogle: TypeSafeCredentials
-
A protocol that a user’s type can conform to representing a user authenticated using a Google OAuth token.
Usage Example:
See morepublic struct ExampleProfile: TypeSafeGoogleToken { let id: String // Protocol requirement: subject's unique id let name: String // Protocol requirement: subject's display name let email: String? // Optional field: may not be granted } router.get("/googleProfile") { (user: ExampleProfile, respondWith: (ExampleProfile?, RequestError?) -> Void) in respondWith(user, nil) }
Declaration
Swift
public protocol TypeSafeGoogleToken: TypeSafeGoogle