Skip to content

Commit

Permalink
Merge pull request #92 from RobertoMachorro/docs-fixes
Browse files Browse the repository at this point in the history
Updated sample code in Facebook docs
  • Loading branch information
0xTim committed Mar 28, 2023
2 parents c12fc31 + 55ee153 commit 49d8d70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/Facebook/README.md
Expand Up @@ -42,12 +42,12 @@ struct FacebookUserInfo: Content {
}

extension Facebook {
static func getUserInfo(on request: Request) throws -> EventLoopFutures<FacebookUserInfo> {
static func getUserInfo(on request: Request) throws -> EventLoopFuture<FacebookUserInfo> {
let token = try request.accessToken()
let facebookUserAPIURL: URI = "https://graph.facebook.com/v3.2/me?fields=id,name,email&access_token=\(token)"
return request.client.get(facebookUserAPIURL).flatMapThrowing { response in
guard response.http.status == .ok else {
if response.http.status == .unauthorized {
guard response.status == .ok else {
if response.status == .unauthorized {
throw Abort.redirect(to: "/login-facebook")
} else {
throw Abort(.internalServerError)
Expand Down

0 comments on commit 49d8d70

Please sign in to comment.