formatexception: the input is not a valid base-64 string as it contains a non-base 64 character
I am trying to log in with an email and password which are already registered in the database but this is what error I get
FormatException: 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.
Here is the line where it breaks:
var result = await this._signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure: false);
More specifically - the model.Email (the emails) breaks it all!
EDIT:
The problem was indeed that the passwords weren't hashed when passed into the database: So in this line of code:
var result = await this._userManager.CreateAsync(user, model.Password);
The model.Password was missing and that is why it wasn't hashed when the User was created. Instead, I passed in the User object PasswordHash = Password and that is why the password was kept as plain text. What a big mistake!
asp.net-mvc authentication facebook-login
add a comment |
I am trying to log in with an email and password which are already registered in the database but this is what error I get
FormatException: 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.
Here is the line where it breaks:
var result = await this._signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure: false);
More specifically - the model.Email (the emails) breaks it all!
EDIT:
The problem was indeed that the passwords weren't hashed when passed into the database: So in this line of code:
var result = await this._userManager.CreateAsync(user, model.Password);
The model.Password was missing and that is why it wasn't hashed when the User was created. Instead, I passed in the User object PasswordHash = Password and that is why the password was kept as plain text. What a big mistake!
asp.net-mvc authentication facebook-login
See if this answer helps: stackoverflow.com/a/37610928/1220550. The SignInAsync seems to expect a Base64 string containing the encoded Hash of the Password. Either give it that, or find a way so it no longer expects that.
– Peter B
Nov 23 '18 at 10:06
@PeterB thanks for the answer! I am indeed storing the password as password , (datatype Is password) and is not as plain text. I wonder what may be the cause
– Edwardcho
Nov 23 '18 at 10:23
add a comment |
I am trying to log in with an email and password which are already registered in the database but this is what error I get
FormatException: 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.
Here is the line where it breaks:
var result = await this._signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure: false);
More specifically - the model.Email (the emails) breaks it all!
EDIT:
The problem was indeed that the passwords weren't hashed when passed into the database: So in this line of code:
var result = await this._userManager.CreateAsync(user, model.Password);
The model.Password was missing and that is why it wasn't hashed when the User was created. Instead, I passed in the User object PasswordHash = Password and that is why the password was kept as plain text. What a big mistake!
asp.net-mvc authentication facebook-login
I am trying to log in with an email and password which are already registered in the database but this is what error I get
FormatException: 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.
Here is the line where it breaks:
var result = await this._signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure: false);
More specifically - the model.Email (the emails) breaks it all!
EDIT:
The problem was indeed that the passwords weren't hashed when passed into the database: So in this line of code:
var result = await this._userManager.CreateAsync(user, model.Password);
The model.Password was missing and that is why it wasn't hashed when the User was created. Instead, I passed in the User object PasswordHash = Password and that is why the password was kept as plain text. What a big mistake!
asp.net-mvc authentication facebook-login
asp.net-mvc authentication facebook-login
edited Nov 23 '18 at 16:45
Edwardcho
asked Nov 23 '18 at 9:59
EdwardchoEdwardcho
13
13
See if this answer helps: stackoverflow.com/a/37610928/1220550. The SignInAsync seems to expect a Base64 string containing the encoded Hash of the Password. Either give it that, or find a way so it no longer expects that.
– Peter B
Nov 23 '18 at 10:06
@PeterB thanks for the answer! I am indeed storing the password as password , (datatype Is password) and is not as plain text. I wonder what may be the cause
– Edwardcho
Nov 23 '18 at 10:23
add a comment |
See if this answer helps: stackoverflow.com/a/37610928/1220550. The SignInAsync seems to expect a Base64 string containing the encoded Hash of the Password. Either give it that, or find a way so it no longer expects that.
– Peter B
Nov 23 '18 at 10:06
@PeterB thanks for the answer! I am indeed storing the password as password , (datatype Is password) and is not as plain text. I wonder what may be the cause
– Edwardcho
Nov 23 '18 at 10:23
See if this answer helps: stackoverflow.com/a/37610928/1220550. The SignInAsync seems to expect a Base64 string containing the encoded Hash of the Password. Either give it that, or find a way so it no longer expects that.
– Peter B
Nov 23 '18 at 10:06
See if this answer helps: stackoverflow.com/a/37610928/1220550. The SignInAsync seems to expect a Base64 string containing the encoded Hash of the Password. Either give it that, or find a way so it no longer expects that.
– Peter B
Nov 23 '18 at 10:06
@PeterB thanks for the answer! I am indeed storing the password as password , (datatype Is password) and is not as plain text. I wonder what may be the cause
– Edwardcho
Nov 23 '18 at 10:23
@PeterB thanks for the answer! I am indeed storing the password as password , (datatype Is password) and is not as plain text. I wonder what may be the cause
– Edwardcho
Nov 23 '18 at 10:23
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444405%2fformatexception-the-input-is-not-a-valid-base-64-string-as-it-contains-a-non-ba%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444405%2fformatexception-the-input-is-not-a-valid-base-64-string-as-it-contains-a-non-ba%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
See if this answer helps: stackoverflow.com/a/37610928/1220550. The SignInAsync seems to expect a Base64 string containing the encoded Hash of the Password. Either give it that, or find a way so it no longer expects that.
– Peter B
Nov 23 '18 at 10:06
@PeterB thanks for the answer! I am indeed storing the password as password , (datatype Is password) and is not as plain text. I wonder what may be the cause
– Edwardcho
Nov 23 '18 at 10:23