You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then i Create credential on the basis of sign in result
private fun handleSignInResult(result: Intent) {
GoogleSignIn.getSignedInAccountFromIntent(result)
.addOnSuccessListener { googleAccount ->
// Use the authenticated account to sign in to the Drive service.
val credential = GoogleAccountCredential.usingOAuth2(
this, listOfScopes
)
credential.selectedAccount = googleAccount.account
than I use it to build in the same way couple services like for drive and app script in a way specified below
val appScriptService = Script.Builder(
createHttpTransport(),
JacksonFactory.getDefaultInstance(),
createRequestInitializer(credential)
)
.setApplicationName(getString(R.string.app_name))
.build()
val googleDriveService: Drive = Drive.Builder(
createHttpTransport(),
JacksonFactory.getDefaultInstance(),
createRequestInitializer(credential)
)
.setApplicationName(getString(R.string.app_name))
.build()
// creating http transport for sign in use
fun createHttpTransport(): HttpTransport {
var res = ApacheHttpTransport.Builder().build()
return res
}
fun createRequestInitializer(reqInit: HttpRequestInitializer): HttpRequestInitializer {
var res = object : HttpRequestInitializer {
override fun initialize(request: HttpRequest?) {
reqInit.initialize(request);
request?.setConnectTimeout(10 * 600000);
request?.setReadTimeout(10 * 600000);
}
}
return res
}
as visible above the appscript and google drive services are created identically (the same applies to docs etc and all of those other services apart from app scipt works!)
then when I try to use function appScriptService.scripts().run() on any object I get error that will be specified below
I had created app Script in google console published, enabled api in the console, enabled in cloud console all authority credentials and IT WORKED up to yesterday. I did not changed anything in code Hovewer when I woke up and tried to develop I was unable to connect to App service,
Code when ivoked in App Script editor works fine
Because other services that are authenthicated in identical way are woring and code stopped working with no changes in part of code responsible for authenthicating I suppose it may be bug
Any relevant stacktrace here.
D/DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@3912bc0[MainActivity]
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
W/AbstractGoogleClient: Application name is not set. Call Builder#setApplicationName.
W/DefaultRequestDirector: Authentication error: Unable to respond to any of these challenges: {}
W/DefaultRequestDirector: Authentication error: Unable to respond to any of these challenges: {}
E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-4
Process: com.example.mituratest, PID: 28327
com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized
{
"code" : 401,
"errors" : [ {
"domain" : "global",
"message" : "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"reason" : "unauthorized"
} ],
"message" : "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status" : "UNAUTHENTICATED"
}
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:443)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1092)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:541)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:474)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:591)
at com.example.mituratest.mainObjects.AppsScriptConnection$checkIsFormReady$2.invokeSuspend(AppsScriptConnection.kt:209)
at com.example.mituratest.mainObjects.AppsScriptConnection$checkIsFormReady$2.invoke(Unknown Source:10)
at com.example.mituratest.utils.MyNet.err(MyNet.kt:15)
at com.example.mituratest.mainObjects.AppsScriptConnection.checkIsFormReady(AppsScriptConnection.kt:209)
at com.example.mituratest.MainActivity$handleSignInResult$1$1$1.invokeSuspend(MainActivity.kt:220)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740)
Environment details
Steps to reproduce
try to connect to App Script through android lie in the code below
Code example
Stack trace
first I establish scopes
I invoke reqest sign in in onCreate
then i Create credential on the basis of sign in result
than I use it to build in the same way couple services like for drive and app script in a way specified below
as visible above the appscript and google drive services are created identically (the same applies to docs etc and all of those other services apart from app scipt works!)
then when I try to use function appScriptService.scripts().run() on any object I get error that will be specified below
I had created app Script in google console published, enabled api in the console, enabled in cloud console all authority credentials and IT WORKED up to yesterday. I did not changed anything in code Hovewer when I woke up and tried to develop I was unable to connect to App service,
Code when ivoked in App Script editor works fine
Because other services that are authenthicated in identical way are woring and code stopped working with no changes in part of code responsible for authenthicating I suppose it may be bug
Any relevant stacktrace here.
Any additional information below
Thanks!
The text was updated successfully, but these errors were encountered: