corbado/flutter-passkeys

FormatException (FormatException: Missing padding character (at character 280) on example project sign up

Closed this issue · 3 comments

FormatException (FormatException: Missing padding character (at character 280)
...Tmk0c0EiLCJhbmRyb2lkUGFja2FnZU5hbWUiOiJjb20uY29yYmFkby5wYXNza2V5cy5wdWIifQ=
^
)

It turns out that the raw is not correctly base64 padded, replace this line:
final raw = '${response.clientDataJSON}=';
with
final raw = padBase64(response.clientDataJSON);

and add function:

String padBase64(String rawBase64) {
  return (rawBase64.length % 4 > 0)
      ? rawBase64 += List.filled(4 - (rawBase64.length % 4), "=").join("")
      : rawBase64;
}

should fix the issue.

just ran into this (same?) issue (https://passkeys.flutter.corbado.io/#/sign-up):
Screenshot 2024-11-07 at 10 40 52 PM

Same
image

Thank you for pointing out the issue and suggesting a solution. I have implemented it in this PR with a few minor adjustments.

If the issue persists, please feel free to reopen it.