DelphiWorlds / Kastri

Cross-platform library for Delphi
MIT License
489 stars 119 forks source link

[AppleSignIn] Potentionally wrong value stored in TAppleIDCredentials.AuthorizationCode #207

Closed havrlisan closed 6 months ago

havrlisan commented 8 months ago

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;
DelphiWorlds commented 8 months ago

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