Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Drive Integration #15

Open
msub2 opened this issue Feb 16, 2021 · 5 comments
Open

Google Drive Integration #15

msub2 opened this issue Feb 16, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@msub2
Copy link
Owner

msub2 commented Feb 16, 2021

This has not been tested yet: need to determine whether it's still working after switching platforms

@msub2 msub2 self-assigned this Feb 16, 2021
@msub2 msub2 added the bug Something isn't working label Feb 16, 2021
@msub2
Copy link
Owner Author

msub2 commented Feb 27, 2021

Currently broken, as it falls back to using Application.openURL to open the external site, which does not work in WebGL. Testing a build with my existing implementation of webxr url opening.

@msub2
Copy link
Owner Author

msub2 commented Feb 27, 2021

actually need to set up Secrets for the API access

@msub2
Copy link
Owner Author

msub2 commented Feb 28, 2021

Stack trace when trying to sign into Google:

ArgumentException: Get Method not found for 'AccessType'
  at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x00000] in <00000000000000000000000000000000>:0 
  at Google.Apis.Requests.Parameters.ParameterUtils.IterateParameters (System.Object request, System.Action`3[T1,T2,T3] action) [0x00000] in <00000000000000000000000000000000>:0 
  at Google.Apis.Requests.Parameters.ParameterUtils.InitParameters (Google.Apis.Requests.RequestBuilder builder, System.Object request) [0x00000] in <00000000000000000000000000000000>:0 
  at Google.Apis.Auth.OAuth2.Requests.AuthorizationCodeRequestUrl.Build () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.LocalHttpCodeReceiver+<ReceiveCodeAsync>d__7.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.LocalHttpCodeReceiver.ReceiveCodeAsync (Google.Apis.Auth.OAuth2.Requests.AuthorizationCodeRequestUrl url, System.Threading.CancellationToken taskCancellationToken) [0x00000] in <00000000000000000000000000000000>:0 
  at Google.Apis.Auth.OAuth2.AuthorizationCodeInstalledApp+<AuthorizeAsync>d__8.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 
  at Google.Apis.Auth.OAuth2.AuthorizationCodeInstalledApp.AuthorizeAsync (System.String userId, System.Threading.CancellationToken taskCancellationToken) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2CredentialRequest+<AuthorizeAsync>d__13.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2CredentialRequest.AuthorizeAsync () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2Identity+<AuthorizeAsync>d__43.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2Identity.AuthorizeAsync () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2Identity+<LoginAsync>d__45.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2Identity.LoginAsync () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.SketchControlsScript.IssueGlobalCommand (TiltBrush.SketchControlsScript+GlobalCommands rEnum, System.Int32 iParam1, System.Int32 iParam2, System.String sParam) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OptionButton.OnButtonPressed () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.ProfilePopUpButton.OnButtonPressed () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.BaseButton.ButtonPressed (UnityEngine.RaycastHit rHitInfo) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.UIComponent.UpdateStateWithInput (System.Boolean inputValid, UnityEngine.Ray inputRay, UnityEngine.GameObject parentActiveObject, UnityEngine.Collider parentCollider) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.BaseButton.UpdateStateWithInput (System.Boolean inputValid, UnityEngine.Ray inputRay, UnityEngine.GameObject parentActiveObject, UnityEngine.Collider parentCollider) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.UIComponentManager.UpdateUIComponents (UnityEngine.Ray selectionRay, System.Boolean inputValid, UnityEngine.Collider parentCollider) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.PopUpWindow.UpdateUIComponents (UnityEngine.Ray rCastRay, System.Boolean inputValid, UnityEngine.Collider parentCollider) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OptionsPopUpWindow.UpdateUIComponents (UnityEngine.Ray rCastRay, System.Boolean inputValid, UnityEngine.Collider parentCollider) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.BasePanel.UpdatePanel (UnityEngine.Vector3 vToPanel, UnityEngine.Vector3 vHitPoint) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.SketchControlsScript.UpdateActiveGazeObject () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.SketchControlsScript.UpdateControls () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.App.Update () [0x00000] in <00000000000000000000000000000000>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <00000000000000000000000000000000>:0 
  at Google.Apis.Auth.OAuth2.AuthorizationCodeInstalledApp+<AuthorizeAsync>d__8.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 
  at Google.Apis.Auth.OAuth2.AuthorizationCodeInstalledApp.AuthorizeAsync (System.String userId, System.Threading.CancellationToken taskCancellationToken) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2CredentialRequest+<AuthorizeAsync>d__13.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2CredentialRequest.AuthorizeAsync () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2Identity+<AuthorizeAsync>d__43.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2Identity.AuthorizeAsync () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2Identity+<LoginAsync>d__45.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OAuth2Identity.LoginAsync () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.SketchControlsScript.IssueGlobalCommand (TiltBrush.SketchControlsScript+GlobalCommands rEnum, System.Int32 iParam1, System.Int32 iParam2, System.String sParam) [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.OptionButton.OnButtonPressed () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.ProfilePopUpButton.OnButtonPressed () [0x00000] in <00000000000000000000000000000000>:0 
  at TiltBrush.BaseButton.ButtonPressed (UnityEngine.RaycastHit rHitInfo) [0x00000] in <00000

@msub2
Copy link
Owner Author

msub2 commented Mar 28, 2021

Ended up having to paste the actual source for Google.Apis.Auth into the scripts folder, only thing keeping google sign in from working is #25

@msub2
Copy link
Owner Author

msub2 commented Apr 13, 2021

BIG progress. Wrote a jslib function that successfully fetches a token response from Google's OAuth endpoint and passes it back into unity as a stringified JSON object that gets deserialized back into a TokenResponse object and stored in the PlayerPrefsDataStore. Refresh of the page shows that it is actually reauthorizing successfully! Still have some reflection errors though, probably need to add more Google api source code into the project. Probably need to look into a better solution at some point.

@msub2 msub2 added this to To Do in Conversion Cleanup Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

1 participant