Skip to content

Commit

Permalink
Fix OAuth URL building throwing an error (#449)
Browse files Browse the repository at this point in the history
There is a syntax error when calling build_query.
  • Loading branch information
mrashed-dev committed Jan 4, 2024
1 parent ed85766 commit a3f8d4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* **BREAKING CHANGE**: Moved `Grants.create()` to `Auth.customAuthentication()`
* Add support for contacts API
* Fixed issue when sending message without attachments
* Fixed issue when building an OAuth2 URL

### 6.0.0-beta.2 / 2023-11-21
* Added additional error classes
Expand Down
25 changes: 5 additions & 20 deletions lib/nylas/resources/auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,32 +158,17 @@ def build_query(config)
"access_type" => config[:access_type] || "online",
"response_type" => "code"
}
set_params(config)

URI.encode_www_form(params)
end

# Set the parameters for the query
def set_params(config)
params["provider"] = config[:provider] if config[:provider]
set_config_params(config)
set_more_config(config)
end

# Set login related configurations
def set_config_params(config)
params["prompt"] = config[:prompt] if config[:prompt]
params["metadata"] = config[:metadata] if config[:metadata]
params["state"] = config[:state] if config[:state]
params["scope"] = config[:scope].join(" ") if config[:scope]
if config[:login_hint]
params["login_hint"] = config[:login_hint]
params["include_grant_scopes"] = config[:include_grant_scopes].to_s if config[:include_grant_scopes]
end
params["scope"] = config[:scope].join(" ") if config[:scope]
end

# More config
def set_more_config(config)
params["prompt"] = config[:prompt] if config[:prompt]
params["metadata"] = config[:metadata] if config[:metadata]
params["state"] = config[:state] if config[:state]
URI.encode_www_form(params)
end

# Hashes the secret for PKCE authentication.
Expand Down

0 comments on commit a3f8d4a

Please sign in to comment.