Skip to content

Commit

Permalink
Fix issue with Vapor returning false for missing body parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTim committed Jan 1, 2025
1 parent 48a97c9 commit a1da23f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct AuthorizePostHandler {
throw Abort(.badRequest)
}

guard let approveApplication: Bool = request.content[OAuthRequestParameters.applicationAuthorized] else {
guard let approveApplicationReceived: Bool? = request.content[OAuthRequestParameters.applicationAuthorized], let approveApplication = approveApplicationReceived else {
throw Abort(.badRequest)
}

Expand Down
10 changes: 5 additions & 5 deletions Sources/VaporOAuth/Utilities/StringDefines.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
struct OAuthRequestParameters {
enum OAuthRequestParameters {
static let clientID = "client_id"
static let clientSecret = "client_secret"
static let redirectURI = "redirect_uri"
Expand All @@ -15,7 +15,7 @@ struct OAuthRequestParameters {
static let token = "token"
}

struct OAuthResponseParameters {
enum OAuthResponseParameters {

static let error = "error"
static let errorDescription = "error_description"
Expand All @@ -31,7 +31,7 @@ struct OAuthResponseParameters {
static let email = "email_address"
static let expiry = "exp"

struct ErrorType {
enum ErrorType {
static let invalidRequest = "invalid_request"
static let invalidScope = "invalid_scope"
static let invalidClient = "invalid_client"
Expand All @@ -42,11 +42,11 @@ struct OAuthResponseParameters {
}
}

struct ResponseType {
enum ResponseType {
static let code = "code"
static let token = "token"
}

struct SessionData {
enum SessionData {
static let csrfToken = "CSRFToken"
}

0 comments on commit a1da23f

Please sign in to comment.