Kastri icon indicating copy to clipboard operation
Kastri copied to clipboard

[AppleSignIn] Potentionally wrong value stored in TAppleIDCredentials.AuthorizationCode

Open havrlisan opened this issue 1 year ago • 1 comments

When signing in with Apple, the TAuthorizationControllerDelegate stores the received authorization credentials to a TAppleIDCredentials record. However, it seems you've accidentally stored the wrong value in one of the records fields:

{ DW.AuthenticationServices.iOS.pas:151 }
LCredentials.AuthorizationCode := NSStrToStr(LAppleIDCredential.email);

Should it not be the value LAppleIDCredential.authorizationCode? Something like this, considering it is of type NSData:

if LAppleIDCredential.authorizationCode <> nil then
begin
  var
  LAuthCode := TNSString.Wrap(TNSString.Alloc.initWithData(LAppleIDCredential.authorizationCode, NSUTF8StringEncoding));
  if LAuthCode <> nil then
    LCredentials.AuthorizationCode := NSStrToStr(LAuthCode);
end;

havrlisan avatar Feb 06 '24 09:02 havrlisan

Weird.. not sure how I missed that.. thanks!

DelphiWorlds avatar Feb 06 '24 10:02 DelphiWorlds