all the code which process request_token is inside zerodhaRedirect controller. not in base controller / . so this request_token will not be able to process inside base controller. base controller is primarily for just redirecting to appropriate route or default route.
redirection should be on given url, right?, else if you are going to actually redirect to base_url then there is no need to ask for redirect_url separately in app configuration. Don't you think so?
In Kite redirect flow we have to append some query params to the final redirect URL like `status` and `request_token`. So here the problem is that angular uses hash fragment to do the frontend routing but as per URL standard formats the hash fragment is always the last part of the URL after query param since anything which comes after hash fragment is considered part of the hash fragment.
For example check this
Actual redirect below. You can see that `hash: "#/zerodhaRedirect"` which is parsed correctly.
new URL("https://www.fando.in/?action=login&type=login&status=success&request_token=abcdSassEE32DFssa#/zerodhaRedirect")
Redirect you are expecting. You can see that `hash: "#/zerodhaRedirect?action=login&type=login&status=success&request_token=abcdSassEE32DFssa"` which is wrongly parsed.
new URL("https://www.fando.in/#/zerodhaRedirect?action=login&type=login&status=success&request_token=abcdSassEE32DFssa")
So what Kite redirects to is fine, its just that Angular is not handling both query params and hash fragment in the URL properly. Easy solution is to handle the redirect in your backend only or switch Angular to `PathLocationStrategy` instead of `HashLocationStrategy`.
Hi thanks for reply, Yes I can handle redirection at backend and just again read the documentation that you have redirect_params option in login api to get back extra unique identification for user session at my end. This resolves my problem. thank you.
Additional point :- `PathLocationStrategy` has demerits, it doesn't load a page on page refresh[ctrl+r or f5] so we have to switch it to `HashLocationStrategy`. still I believe kite redirect API is not correct or we can say not compatible with latest frameworks in market like Angular and ReactJs. there should be extra additional configuration that application is in latest frontend frameworks or traditional code which is in plain javascript & html. on that basis # route should adjusted before redirecting.
I am not sure how it works in Angular but In Vue and React atleast you can refresh the page with location history on so there must be some workaround in Angular.
> still I believe kite redirect API is not correct or we can say not compatible with latest frameworks in market like Angular and ReactJs
As I said we are just following the URL standard, if we don't then it will break for many others so if you are using some tech which doesn't honor the url standards then you need to make a workaround.
Just Updating for somebody else reference. combination of PathLocationStrategy and redirection to index.html using .htaccess resolve issue of non # url page refresh issue. and and without # kite redirection works fine.
For example check this
Actual redirect below. You can see that `hash: "#/zerodhaRedirect"` which is parsed correctly.
Redirect you are expecting. You can see that `hash: "#/zerodhaRedirect?action=login&type=login&status=success&request_token=abcdSassEE32DFssa"` which is wrongly parsed. So what Kite redirects to is fine, its just that Angular is not handling both query params and hash fragment in the URL properly. Easy solution is to handle the redirect in your backend only or switch Angular to `PathLocationStrategy` instead of `HashLocationStrategy`.
> still I believe kite redirect API is not correct or we can say not compatible with latest frameworks in market like Angular and ReactJs
As I said we are just following the URL standard, if we don't then it will break for many others so if you are using some tech which doesn't honor the url standards then you need to make a workaround.
https://www.tektutorialshub.com/angular/the-requested-url-was-not-found-on-this-server-error-in-angular/