Add support for including custom query parameters in the authorisation URL.
(require '[oauth.two :refer :all])
(def client
(make-client {:authorize-uri "https://provider.com/oauth/authorize"
:redirect-uri "https://example.com/"
:scopes #{"read"}}))
(authorization-url client
{:scopes #{"read" "write" "admin"}}
{:approval_prompt "auto"})
;; => https://provider.com/oauth/authorize?
;; approval_prompt=auto&
;; redirect_uri=https%3A%2F%2Fexample.com%2F&
;; response_type=code
This is more of a convenience feature than anything else. You used to be able to append parameters to the end of the URL, but as it’s quite a common operation I’ve added support to the library.
Rename scopes to scope everywhere.
You’ll need to change the map you pass into make-client
and/or
authorization-url
so that instead of passing :scopes
you pass :scope
.
Before:
(def client
(make-client {:scopes #{"read"}}))
(authorization-url client {:scopes #{"read" "write" "admin"}})
And now:
(def client
(make-client {:scope #{"read"}}))
(authorization-url client {:scope #{"read" "write" "admin"}})
Make useful schema like ClientConfig
, AuthorizationParams
, and
TokenRequestParams
public so they can be used in third-party code that wants
to validate the boundary between them and us.