Is it possible to authenticate Google Spreadsheets API access using GoogleWebAuthorizationBroker in WP 8.1?

I’m trying to work with Google Spreadsheets in my Windows Phone 8.1 project but running into some issues. The old .NET libraries for Google Sheets haven’t been updated in years and don’t work with WP 8.1.

I found that Google has a newer Auth package on NuGet that supports Windows Phone 8.1 and works with Google Drive. In their documentation, they show how to use OAuth 2 authentication with GoogleWebAuthorizationBroker.AuthorizeAsync for Drive access using scopes like DriveService.Scope.DriveReadonly.

The problem is I can’t find any equivalent scope constants for Google Sheets. There also don’t seem to be any NuGet packages specifically for Google Docs or Sheets.

Has anyone successfully used GoogleWebAuthorizationBroker.AuthorizeAsync to get authorization for Google Sheets API? What scope should I use for this?

You can definitely use GoogleWebAuthorizationBroker for Sheets API access on WP 8.1. The key is understanding that Google Sheets v4 API actually falls under the broader Google Sheets scope, not the old Drive scopes. For read-only access, use “https://www.googleapis.com/auth/spreadsheets.readonly” and for full access use “https://www.googleapis.com/auth/spreadsheets”. These are string literals since there aren’t predefined constants in the older packages. I ran into the same issue last year when working on a similar project. The authentication flow works exactly the same as with Drive - just pass the Sheets scope URL directly to AuthorizeAsync instead of using the Drive scope constants. Once you get the credential object back, you can make direct HTTP requests to the Sheets v4 REST API endpoints since the dedicated .NET client library support was limited back then for WP 8.1.

Worth mentioning that after you get the authentication working, you’ll need to handle the HTTP requests manually since there wasn’t a proper Sheets client library for WP 8.1 at that time. I ended up using HttpClient to make REST calls directly to the v4 API endpoints. The tricky part is properly formatting the authorization header with your access token - it should be “Bearer [your_token]” in the Authorization header. Also keep in mind that access tokens expire, so implement token refresh logic using the refresh token you get back from the initial auth flow. The Google.Apis.Auth package handles most of this if you store the credential properly, but you’ll want to wrap your API calls in try-catch blocks to handle token expiration gracefully.

just went thru this headache myself few months back. yeah googlewebauthorizationbroker works fine but you gotta use the raw scope strings like ethan mentioned. one thing tho - make sure your app manifest has the web authentication broker capability enabled or it’ll fail silently. also heads up that wp 8.1 has some quirks with the auth popup so test on actual device not just emulator