Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Giovanni Sidoel 94 posts 233 karma points
    Feb 19, 2018 @ 17:38
    Giovanni Sidoel
    0

    "The input is not a valid Base-64 string" when calling Members.Login

    Hi. I'm trying to log our members in using the following code

    Members.Login("jurian360", "password");
    

    However this keeps throwing the following error:

    The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

    I am running Umbraco version 7.7.7 assembly: 1.0.6554.23584.

    The only other similar thread I could find was http://issues.umbraco.org/issue/U4-10752 but did not provide a solution for us.

    Looking forward to your help.

  • Joshua Lemli 52 posts 234 karma points
    Feb 19, 2018 @ 19:09
    Joshua Lemli
    0

    Check out the encryption options for Umbraco passwords. In the DB, you can either store passwords as "plain text" or "encrypted".

    I believe "encrypted" stores them as a base-64 encoded URI (although there may be a hash involved, too).

    A work-around might be to simply check that their password matches, then log them in manually:

    System.Web.Security.FormsAuthentication.SetAuthCookie("membersEmailHere", true);
    
  • Giovanni Sidoel 94 posts 233 karma points
    Feb 19, 2018 @ 19:32
    Giovanni Sidoel
    0

    Thanks for your input.

  • Giovanni Sidoel 94 posts 233 karma points
    Feb 19, 2018 @ 19:17
    Giovanni Sidoel
    0

    I've been able to narrow it down further: It seems to only be a problem when I assign the password in code

    if (model.GoogleUser)
                {
                    memberService.SavePassword(member, "HelloFromGoogle2018");
                }
                else
                {
                    memberService.SavePassword(member, model.Password);
                }
    
                memberService.Save(member);
    

    If I assign the password via the normal Umbraco back-end, I am able to log in fine.

    Furthermore, I have tried assigning the password via .CreateWithIdentity. This gives the exact same result.

  • Giovanni Sidoel 94 posts 233 karma points
    Feb 19, 2018 @ 19:31
    Giovanni Sidoel
    4

    Ok. It seems this was just a logical error on my part. I was calling .SavePassword before I had saved the member. All seems ok now.

  • Jonas Widenberg 21 posts 102 karma points
    Apr 04, 2019 @ 07:07
    Jonas Widenberg
    0

    Ah. Thanks! This helped me solve the same issue.

  • Kasper 13 posts 84 karma points
    Apr 05, 2022 @ 09:48
    Kasper
    0

    Thanks, this was my exact issue as well! Took a look at my created member in the backoffice and realised the "Last Password Change Date" property was empty.

  • Richard Ockerby 28 posts 202 karma points MVP 3x c-trib
    Feb 01, 2022 @ 00:44
    Richard Ockerby
    0

    I too came across this problem today. To add to the above, this error will throw when the user doesn't have a password.

    In my case, MemberService.SavePassword was correctly throwing an error (the password didn't meet criteria) so trying to login to this user threw the error.

Please Sign in or register to post replies

Write your reply to:

Draft