When to call Google + Silent Authentication in iOS

For me authenticatedwith google plus fast-app-switch.I have seen quiet authentication with google plus sdk. I want to enter silence a second time into the application. That is, if the user tries to log in for the first time, I redirect using safari for authentication (now I did it). But the second time, I just invoke silent authentication, checking some criteria, such as an authentication token, whether it has expired or some other condition.

Pseudocode ..

if (....what condition...)
   [signIn trySilentAuthentication];

Invite me to check this condition and call slientAuthentication?

Note: I saw this question [QA1 , QA2 , QA3] , but everyone has been told about authentication, but not about silent authentication.

+4
source share
1 answer

Finally, I found doing some practice. You can see the code below.

GPPSignIn *signIn = [GPPSignIn sharedInstance];
if ([[GPPSignIn sharedInstance]hasAuthInKeychain])
{
    if (![signIn trySilentAuthentication])//because some time, it may expired 
        [self initialAuthentication];
}
else
{
   [self initialAuthentication];
}
+3
source

Source: https://habr.com/ru/post/1529945/


All Articles