-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
email and password not coming through params when signing in user. #61
Comments
I should add, when I print the parameters coming through the hash, it says they are this:
|
I understand that the reason they are coming back as empty strings is because the params[:password] and params[:email] looks for the key "password' and 'email' in the params hash, but there are no actual keys called that. How can I format my request from the iOS side so that instead my params hash looks like:
|
It may be because you're not setting the content type to "application/json" in the header |
Your hash looks good, have you tried @SirUncleCid suggestion about the header? Something I notice is the |
I have same issue I send my email and password via basic-authenticate header I have solves this problem @kurenn is there a solution so that we can use authorization header instead sent it via post parameter? I think we can use the authorization header by parsing it by ourself and assign it to the desired variables my code for sessions_controller.rb so that we can take email and passwords from authorization header
@kurenn hey bro i think you have a lot things to do for your next(rails5) books keep the good works I hope your book will be stable as michael hartl's |
@buncismamen Yeah on the new version I'm working on, I'll make a better effort on making the book more stable and less painful in some parts, and thanks for the kind words! |
I am trying to access this from my iPhone app. I am trying to sign someone in via a post request, by sending in the email and password. currently I am just hard coding the email and password. Here is my code:
You're first reaction is probably "it should be params[:session][:password] and params[:session][:email]." However, I already tried that, and when I do it that way, I get a server error 500. Actually, when I run the request as params[:session][:password], in my terminal (as I am tracking each request), I get the following error:
So it says that there is an error in line 4 (which is of course where the params[:session][:password] line is). When I run just params[:password] there is no error, and it connects to the server, but the email and password come through as empty strings. I know this because I put this:
and puts user evaluated to false, and user_email and user_password were just blank.
How can I get these values to come through from my iPhone app? And here is my code from Xcode:
thanks
The text was updated successfully, but these errors were encountered: