You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What Version of the library are you using?
v17.1.0
Question
I have implemented the flow for AWS Cognito as my identity provider. When i try to call the .authorize() function i get redirected to the AWS Cognito login pages as expected. After i login i get redirected to the provided callback URL with the code query parameter but the library keeps telling me i am not authenticated, from my understanding there should have been another call to AWS Cognito to retrieve an access token based on the code given in the callback URL.
I have created a clean Angular v17 without SSR application and included the bare minimum quick start code but the same problem occurs when trying to authenticate. Am i missing something which retrieves the access token from AWS Cognito?
EDIT: Some extra information; after logging in the code authorization seems to be happening and i enter public event type 7 which indicates i am authenticated but .checkAuth() function keeps saying isAuthenticated: false and i can't get a token.
The text was updated successfully, but these errors were encountered:
For me this issue was solved by correcting the config.redirectUrl. I had accidentally told our IdP to add our URLs with a trailing slash. I guess without trailing slashes are the standard, but I was clumsy while handing over our URLs.
In version 17 of this library, the UrlService.isCallbackFromSts() looks like the following:
isCallbackFromSts(currentUrl,config){if(config&&config.checkRedirectUrlWhenCheckingIfIsCallback){constcurrentUrlInstance=newURL(currentUrl);constredirectUrl=this.getRedirectUrl(config);if(!redirectUrl){this.loggerService.logError(config,`UrlService.isCallbackFromSts: could not get redirectUrl from config, was: `,redirectUrl);returnfalse;}constredirectUriUrlInstance=newURL(redirectUrl);constredirectUriWithoutQueryParams=this.getUrlWithoutQueryParameters(redirectUriUrlInstance).toString();constcurrentUrlWithoutQueryParams=this.getUrlWithoutQueryParameters(currentUrlInstance).toString();constredirectUriQueryParamsArePresentInCurrentUrl=this.queryParametersExist(redirectUriUrlInstance.searchParams,currentUrlInstance.searchParams);// PROBLEMATIC ROW BELOW, BUT PRESUMABLY 100% CORRECT// PROBLEMATIC ROW BELOW, BUT PRESUMABLY 100% CORRECTif(redirectUriWithoutQueryParams!==currentUrlWithoutQueryParams||!redirectUriQueryParamsArePresentInCurrentUrl){returnfalse;}}returnCALLBACK_PARAMS_TO_CHECK.some((x)=>!!this.getUrlParameter(currentUrl,x));}
The issues was simply that the current URL doesn't include a trailing slash like the config.redirectURL had. I presume this is correct.
What Version of the library are you using?
v17.1.0
Question
I have implemented the flow for AWS Cognito as my identity provider. When i try to call the .authorize() function i get redirected to the AWS Cognito login pages as expected. After i login i get redirected to the provided callback URL with the code query parameter but the library keeps telling me i am not authenticated, from my understanding there should have been another call to AWS Cognito to retrieve an access token based on the code given in the callback URL.
I have created a clean Angular v17 without SSR application and included the bare minimum quick start code but the same problem occurs when trying to authenticate. Am i missing something which retrieves the access token from AWS Cognito?
EDIT: Some extra information; after logging in the code authorization seems to be happening and i enter public event type 7 which indicates i am authenticated but .checkAuth() function keeps saying isAuthenticated: false and i can't get a token.
The text was updated successfully, but these errors were encountered: