Authorisation

I'm trying to find solutin how to auto login on Google in my WKWebView, i tried looking for solutions o internet but without luck. Im' new at programing so i'm not very good with HTTP requests and i don't understand them very well. I want, for example, when i press the buttont o lead me to myaccount page in my webView. I know this is a "big" question but i hope there is somebody willing to help.

I'm trying to find solutin how to auto login on Google in my

WKWebView

Most web sites uses cookie-based authentication. While the exact mechanics of this vary from site to site, the basic idea is something like this:

  1. The site presents a form with a user name and password field

  2. The user enters that data and taps Log In

  3. That does an HTTP

    POST
    containing the data from the fields
  4. The server authenticates based on that

  5. If it works, the server returns a cookie as part of the response

  6. The server authenticates subsequent requests based on that cookie

Emulating this in general is very hard because:

  • Different sites do it differently, meaning you have lots of site-specific code

  • The approach used by any given site is controlled by the site, and they can change it without notice

I want, for example, when i press the buttont o lead me to myaccount page in my webView.

Is this for your own personal use? Or for a product that you intend to ship to lots of users?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

It's supposed to be for many users, where thay can type in their username and pass and have their home page presented to them. Thank you for explanation about cookie-based authentication.

It's supposed to be for many users …

OK, that makes this problem quite hard. For any given large web property — Google, Apple, Facebook, whatever — there are some fraction of users that are exceptional. Let’s just consider Apple for the moment, because I’m more familiar with that space:

  • Not all Apple IDs are email addresses. For example, my work Apple ID is just a vanilla user name.

  • These vanilla user name Apple IDs are not restricted to just employees. Some third-party folks I know, who’ve been in the Apple ecosystem for a long time, have similar user name Apple IDs

  • Many Apple IDs log in with more than just a user name and password.

  • There are at least two alternative login schemes, the older two-step authentication and the newer two-factor authentication.

  • Most folks uses two-factor authentication deal with 4-digit codes, but some folks get 6-digits codes.

All of this makes it hard to build an alternative user interface for logging in that isn’t just a web browser. It’s possible that Google documents what’s necessary to make this work. If not, you’ll have to experiment and then deal with the possibility that a) you might not work with all users correctly, and b) things might change in the future.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thank you for your answer!

Authorisation
 
 
Q