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 93 posts 230 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 93 posts 230 karma points
    Feb 19, 2018 @ 19:32
    Giovanni Sidoel
    0

    Thanks for your input.

  • Giovanni Sidoel 93 posts 230 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 93 posts 230 karma points
    Feb 19, 2018 @ 19:31
    Giovanni Sidoel
    2

    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 12 posts 83 karma points
    Apr 04, 2019 @ 07:07
    Jonas Widenberg
    0

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

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies