I have followed the tutorial till chapter 19 page 308 .
Build and run IOS app .
When I input user name ,password and tabbed login it fails .
After I go through the code in Auth.swift and LoginTableViewController.swift , There are not any wrong , it’s same as tutorial . Also checked the response in Rested. It response “OK” as below.
Appreciated if you could advise.
Response from API in Rested App
https:///api/users/login
and set Authorization (user:admin, password: password) .
It response status code "200 OK "as below.
I have the same question. I have completed the book up to this point. In Postman, I get a 200 response, but in the app I get 401. My code is correct space after “Basic” etc. Are there any other solutions you can think of? I am stuck
I had the same problem, because the starter project contains the url “rw-til.vapor.cloud” in some files. After changing all of them in the iOS project, it worked.
@reeder3240 did @ericlm solution help? If not can you debug the request in the app to make sure it’s sending it to your server? Then does it work in Rested?
Edit: In Postman, I can log in just fine with admin account. Then when I pass that token in the app, I can log in fine. Then if I create a new user, remove that token, and try to log in with new user, I get 401 error again. In the app, I simply do not get a token passed back to me from the log in page.
Have you tried resetting the database? Everything looks valid, so I don’t know quite what’s going on. When you say loginString is correct, how are you creating it? Does the final project from the book chapter work if you change the URLs?