Base solution for your next web application
Open Closed

Issue redirecting user to external Oauth endpoint #6431


User avatar
0
aggarwal created

Hi,

I am building an integration into an api. As a starting point I need to authorise the application.

Normally, following command from the controller works. return Redirect(url);

however, in my case I am executing an action from the jQuery action.

I have this snippet from the jQuery script, which is calling the controller correctly. text: app.localize('Authorise'), visible: function () { return entityHistoryIsEnabled(); }, action: function (data) { abp.ajax({ url: '/App/Integrations/Register', data: JSON.stringify({ id: data.record.Integration.id }), }); }

However, the ABP is expecting a JSON response and redirect fails.

If I move the controller code to Index(), it works fine.

Any advice on what command to use to redirect from tje jQuery script?

I can return the URL as JSON back to the script and redirect from there.

Reference: https://aspnetboilerplate.com/Pages/Documents/Javascript-API/AJAX

Many thanks.

Regards, Vikas


1 Answer(s)
  • User Avatar
    0
    aggarwal created

    window.location = response.url; fixes the problem :)