I have Swift app and I would like to create Google login without the use of SDK.
For Facebook login, I use ASWebAuthenticationSession. Is this possible to use this for Google as well?
When I try to setup OAuth based on flow from Facebook OAuth, I got blank screen.
I create URI like this:
let callbackScheme = "com.company.myapp"
let redirectUrl = "\(callbackScheme):/oauth2Callback"
let PERMISSION_SCOPES = ["email", "profile"]
let tmp = GoogleLoginHelper.PERMISSION_SCOPES.map { "https://www.googleapis.com/auth/userinfo.\($0)"}
let scope = tmp.joined(separator: " ")
var url = URL(string: "https://accounts.google.com/o/oauth2/token")!
url.appendQueryItem(name: "client_id", value: "<MY_CLIENT_ID>)
url.appendQueryItem(name: "redirect_uri", value: "\(redirectUrl)")
url.appendQueryItem(name: "response_type", value: "code")
url.appendQueryItem(name: "state", value: UUID().uuidString)
url.appendQueryItem(name: "scope", value: scope)
url.appendQueryItem(name: "access_type", value: "offline")
url.appendQueryItem(name: "prompt", value: "consent")
However, when I use this with ASWebAuthenticationSession, I got blank screen.
I have also tried to use callbackScheme based on iOS URL scheme from google cloud management but with the same result.
Once I obtain code from API, I send this code to my backend server, where access token is obtained and based on it, user email, that is later linked to my login flow.
The same logic works on my web and I want to manage users only from one place on my server backend.
I also dont know, If I should create client id for iOS app (or Android), or use my web assigned one.




