My webapp depends on redirects from an external authentication server. The app was working in the past but as I downloaded the latest version of webcore there exists a code block inside unit WEBLib.Forms;
// there is a code callback
if FParameters.IndexOfName('code') <> -1 then
begin
if Assigned(OnOAuthToken) then
OnOauthToken(Self, query);
FIsRedirect := true;
token := FParameters.Values['code'];
asm
if (window.opener && window.opener.processAuthData){
window.opener.processAuthData(token);
window.close();
}
end;
end;
I commented this block of code because it sets FIsRedirect := true; and at later stages it does does not create forms just exit if FIsRedirect is set to true.
Could there be a better solution since now on I have to comment this code in your libs each time I update the source code?
It is by design that for an OAUTH callback, the app is not restarted. It should just resume but with the obtained access token.
What exact other behavior do you expect?
Thanks for your reply.
This is my code with the problem:
Application.Initialize;
Application.MainFormOnTaskbar := True;
ShowMainForm := True;
Application.CreateForm(TMainModule, MainModule);
if HasQueryParam('action', ActionPrm) then
begin
if ActionPrm = 'register' then
begin
ShowMainForm := False;
Application.CreateForm(TRegisterForm, RegisterForm);
end
else if ActionPrm = 'login' then
begin
if HasQueryParam('state', StatePrm) then
begin
if StatePrm = 'register' then
begin
ShowMainForm := False;
Application.CreateForm(TRegisterStatusForm, RegisterStatusForm);
end;
end;
end
else if ActionPrm = 'checkout' then
begin
if HasQueryParam('state', StatePrm) then
begin
if StatePrm = 'signing' then
begin
ShowMainForm := False;
Application.CreateForm(TCheckoutStatusForm, CheckoutStatusForm);
end;
end;
end;
end;
if ShowMainForm then
Application.CreateForm(TMainForm, MainForm);
Application.Run;
Since during the application creating forms it justs exists without creating it with a if decision
procedure TApplication.CreateForm(AInstanceClass: TFormClass; AElementID: string; var AReference; AProc: TFormCreatedProc; LoadHTML: boolean);
..
..
begin
if FIsRedirect then
Exit;
This Exit is my problem. I should be able to decide creating forms.
Note: During verification I receive a "code" in the URL so this sets FIsRedirect to true I mentioned in my previous comments
Thanks