FacebookToken
public struct FacebookToken : ClientCredentials
A struct for providing a Facebook Oauth token as credentials to a KituraKit route. The struct is initialized with a token, which will be used to authenticate the user and generate their user profile. This client route mirrors a Kitura Codable route that implements TypeSafeFacebookToken authentication to verify a users identity.
Usage Example:
struct User: ExampleProfile {
let id: String
let name: String
let email: String?
}
client.get("/facebookProfile", credentials: FacebookToken(token: "exampleToken")) { (user: ExampleProfile?, error: RequestError?) -> Void in
guard let user = user else {
print("failed request: \(error)")
}
print("Successfully authenticated and recieved \(user)")
}
-
The users Facebook Oauth token
Declaration
Swift
public let token: String
-
Create a Facebook Token credentials instance with the specified token data.
Declaration
Swift
public init(token: String)
-
Function to generate headers using a provided token Facebook token authentication. The “X-token-type” header is set to be “FacebookToken” and the “access_token” header is set as the provided token.
Declaration
Swift
public func getHeaders() -> [String : String]