首页 > 解决方案 > Use Google Drive API without user's private information

问题描述

I want to upload a file to a user's Drive. I have an Android application backed by a web server, so I can either upload the file directly from the device or have my backend do it.

I don't want access to identifiable information. Privacy is important for my users, and I don't want them to consent to giving me their profile. I don't need it and won't use it.

How can I remove the user's profile from the scope of my token?

enter image description here

In Android code, for my GoogleSignInOptions I'm deliberately NOT using the default scopes, which include profile info. This was my attempt when trying to use my backend:

val options = GoogleSignInOptions.Builder()
        .requestScopes(Scope(Scopes.DRIVE_FILE)) // only my own app's files
        .requestIdToken("<my app id>")
        .build()

Removing the requestIdToken without including requestEmail causes the flow to fail, because no token or ID is returned at all.

标签: androidgoogle-apigoogle-drive-api

解决方案


推荐阅读