Closed cristianedb closed 6 years ago
If you are using the implicit flow, there should be no refresh token returned.
Thanks for your answer, but when I add the line "this.auth.useCodeGrantFlow();" to choose Auth grant flow it not working. Punctually the function parseCognitoWebResponse() doesnt work fine. My callback url is like this.
https://redirect_uri/?code = xxxxxxx & state = yyyy
And never go into of this "if" and then never does the POST to the endpoint /oauth2/token
CognitoAuth.prototype.getCodeQueryParameter = function getCodeQueryParameter(httpRequestResponse) {
var mapSecond = new Map();
mapSecond = this.getQueryParameters(httpRequestResponse, mapSecond);
if (mapSecond.has(this.getCognitoConstants().CODE)) { <----
// if the response contains code
// To parse the response and get the code value.
var codeParameter = this.getCodeParameter(httpRequestResponse);
var url = this.getCognitoConstants().DOMAIN_SCHEME.concat(this.getCognitoConstants().COLONDOUBLESLASH, this.getAppWebDomain(), this.getCognitoConstants().SLASH, this.getCognitoConstants().DOMAIN_PATH_TOKEN);
var header = this.getCognitoConstants().HEADER;
var body = { grant_type: this.getCognitoConstants().AUTHORIZATIONCODE,
client_id: this.getClientId(),
redirect_uri: this.RedirectUriSignIn,
code: codeParameter };
var boundOnSuccess = this.onSuccessExchangeForToken.bind(this);
var boundOnFailure = this.onFailure.bind(this);
this.makePOSTRequest(header, body, url, boundOnSuccess, boundOnFailure);
}
};
I dont know if I have a mistake in my Cognito configuration or there is a bug.
Hi @cristianedb, since we released the bug fix for code grant flow, you can use npm to install the lastest 1.1.0 version and try again. Please let me know if you have any other issues! :)
auth.useCodeGrantFlow() now works fine and this provides a refresh token. all seems to be working great! thanks guys!
In the callback URL only appear access_token and id_token