Skip to content

Commit

Permalink
Merge pull request #7 from nihal-deriv/hydra/public_client
Browse files Browse the repository at this point in the history
updated token exchange endpoint to support both client_secret and cod…
  • Loading branch information
mukesh-deriv authored Oct 7, 2024
2 parents f6e7468 + a86926f commit 867fda7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{$NEXT}}

- Updated `exchange_token` to support caller payload
0.002 2024-10-02 22:21:04+00:00 UTC
- Bug fix in `validate_token` and `validate_id_token` methods.

Expand Down
10 changes: 3 additions & 7 deletions lib/WebService/Hydra/Client.pm
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,12 @@ Exchanges the authorization code with Hydra service for access and ID tokens.
=cut

method exchange_token ($code, $client_id, $client_secret, $redirect_uri) {
method exchange_token ($exchange_payload) {
my $method = "POST";
my $path = "$public_endpoint/oauth2/token";
my $grant_type = "authorization_code";
my $payload = {
code => $code,
grant_type => $grant_type,
client_id => $client_id,
client_secret => $client_secret,
redirect_uri => $redirect_uri
grant_type => 'authorization_code',
$exchange_payload->%*
};
my $result = $self->api_call($method, $path, $payload, 'FORM');
if ($result->{code} != OK_STATUS_CODE) {
Expand Down

0 comments on commit 867fda7

Please sign in to comment.