p2 / OAuth2

OAuth2 framework for macOS and iOS, written in Swift.
Other
1.14k stars 276 forks source link

Automatic login after successful OAuth2PasswordGrant #337

Open frederik-jacques opened 4 years ago

frederik-jacques commented 4 years ago

Hi all,

I was wondering how you would do an automatic login when you have previously done a successful OAuth2PasswordGrant. I'm currently using the following code to show a custom login viewcontroller at launch

passwordGrant = OAuth2PasswordGrant(settings: settings)
passwordGrant.authConfig.authorizeContext = self
passwordGrant.delegate = self

do {
   print("$$ Authorizing")
   try passwordGrant.doAuthorize()
}
catch {
    print("$$ Error authorizing")
    print("$$ \(error.localizedDescription)")
}

But when I relaunch the app the login viewcontroller is shown again, because the email/password fields are empty.