i create wpf application uses google api client library .net. following sample, wrote code below:
var credential = googlewebauthorizationbroker.authorizeasync( secrets, new[] { "https://www.googleapis.com/auth/contacts.readonly" }, "user", cancellationtoken.none, new filedatastore(tokenstoragename)).result;
calling of authorizeasync method opens new browser window/tab login form. problem appears if user close browser window or tab. never result of call.
can how handle situation ?
should change source code of authorizeasync(...) ?
the way i've managed work around bug add timeout period dalmto suggested. it's not ideal haven't found way round issue.
to used following code:
'/ create new threading task /' dim objtask task(of google.apis.auth.oauth2.usercredential) '/ call google auth process /' objtask = googlewebauthorizationbroker.authorizeasync(objsecrets, mobjscopes, "user", cancellationtoken.none, objfilestore) '/ wait 2 minutes response /' objtask.wait(240000) '/ if time out period expired status still waiting activation /' if objtask.status <> tasks.taskstatus.waitingforactivation '/ return user credentials /' return objtask.result end if
Comments
Post a Comment