A packaged app (Chrome App) cannot have less restrictive CSP (Content Security Policy) than the default CSP value. And it looks like the Google Drive Realtime API cannot be used in the Packaged app's without any hacks. Because the default packaged app Content Security Policy (CSP) value disallows the use of eval() or new Function(). However, a variety of library uses eval() and eval-like constructs such as new Fucntions() for performance optimization and for ease of expression. It will result in following error:
"EvalError when trying to load realtime data model"
Steps to resolve this issue:
- Load GAPI using a webview tag.
- Load Webview inside standalone localhost. Use a chrome socket.
- Handle your own OAuth flow and supply the token to the gapi auth client.
This way you can make your Chrome Packaged App to work with Google Drive Realtime API.
Comments
Post a Comment