Google Plus SDK does not update token (iOS)

Use Google Plus SDKfor login. Everything works fine at first, but it seems that the oauth token expires in about 1 hour. I follow the guidelines on Google and using

[signIn trySilentAuthentication] 

in the viewDidAppear function.

I know the token has expired because I use Oauth on my server and get a 401 response.

It is also worth noting that this is not a problem if the iPhone / iPad remains turned on with the screen turned on. In this case, the application runs indefinitely without any problems.

Authentication failed on my Cloud endpoint. I initialize the service as shown below:

static GTLService *service = nil;

if (!service) {
    service = [[GTLServiceMyModel alloc] init];
    service.retryEnabled = YES;
    [service setAuthorizer: [GPPSignIn sharedInstance].authentication];
 }

, , , , - iOS . .

- ? !

+1
2

, . . Java, . !! setAuthorizer , .

static GTLService *service = nil;
if (!service) {
    service = [[GTLServiceMyModel alloc] init];
    service.retryEnabled = YES;
    [service setAuthorizer: [GPPSignIn sharedInstance].authentication];   
}
+1

401 1 . , , - , . , , , 3600 , . https://accounts.google.com/IssuedAuthSubTokens Google + .

0

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


All Articles