From 3bb014e714ffb8a4f33c33d2cac9981551b825c3 Mon Sep 17 00:00:00 2001 From: Gabriel Rosa Date: Wed, 15 Jun 2022 10:08:03 -0300 Subject: [PATCH] get redirect_uri from get_tokens_url_params --- src/clients/inputs/client.service.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/clients/inputs/client.service.ts b/src/clients/inputs/client.service.ts index fd86ad2..805e3a0 100644 --- a/src/clients/inputs/client.service.ts +++ b/src/clients/inputs/client.service.ts @@ -218,9 +218,18 @@ export class InputsClientService implements OnModuleInit { ...secrets, ...credentials, }); - const get_tokens_url_params_obj = JSON.parse( - get_tokens_url_params_string, - ); + let get_tokens_url_params_obj: Record = {}; + try { + get_tokens_url_params_obj = JSON.parse( + get_tokens_url_params_string, + ); + } catch (error) { + throw new HttpException( + 'Erro transformando get_tokens_url_params', + 400, + ); + } + const { redirect_uri } = get_tokens_url_params_obj; for (const key in get_tokens_url_params_obj) { const value = get_tokens_url_params_obj[key]; requestParams.append(key, value); @@ -238,6 +247,7 @@ export class InputsClientService implements OnModuleInit { const responseKey = get_tokens_set_response[key]; credentialsTokens[key] = data[responseKey]; } + redirect_uri.redirect_uri = redirect_uri; } break; }