Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Erro ao utilizar o ConnectApi com variaveis #21

@rcaneppele

Description

@rcaneppele

O seguinte exemplo de código, utilizando variaveis, gera um erro 400:

OAuth auth = new OAuth(semAntecipacao ? oauthTokenSemAntecipacao : oauthTokenComAntecipacao);
Client client = new Client(moipEndpoint, auth);
API api = new API(client);

ConnectRequest connectRequest = new ConnectRequest()
		.clientId(semAntecipacao ? clientIdSemAntecipacao : clientIdComAntecipacao)
		.clientSecret(semAntecipacao ? clientSecretSemAntecipacao : clientSecretComAntecipacao)
		.code(code)
		.redirectUri(semAntecipacao ? redirectUrlSemAntecipacao : redirectUrlComAntecipacao)
		.grantType(GrantType.AUTHORIZATION_CODE);

Connect connect = api.connect().authorize(connectRequest);
String accessToken = connect.getAccessToken();
String idMoip = connect.getMoipAccount().getId();

Passando os valores manualmente funciona sem problemas:

OAuth auth = new OAuth("XXXXXX_v2");
Client client = new Client("https://api.moip.com.br", auth);
API api = new API(client);

ConnectRequest connectRequest = new ConnectRequest()
		.clientId("APP-XXXXXXXXXXXX")
		.clientSecret("XXXXXXXXX")
		.code(code)
		.redirectUri("XXXX")
		.grantType(GrantType.AUTHORIZATION_CODE);

Connect connect = api.connect().authorize(connectRequest);
String accessToken = connect.getAccessToken();
String idMoip = connect.getMoipAccount().getId();

No exemplo das variáveis, elas estão com os valores corretos, igual ao exemplo anterior que passa os valores manualmente.

Isso aconteceu apenas em ambiente de PRODUCAO.
No sandbox funcionou corretamente.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions