Ckan by default allowed URL redirects after login by specifying it in the came_from parameter of the request. However, when ckan runs from non root path, ie. /data, any redirects would be appended to the base API. To get around this and redirect to any URL, copy pasted the logged_in code into a custom controller to handle redirects to any URL.