简体   繁体   English

在Android App中使用AutoML Vision REST API

[英]Using AutoML Vision REST API in Android App

I want to use AutoML Vision REST API in Android App. 我想在Android App中使用AutoML Vision REST API

The recommended way to Authenticate with API is through Service Accounts. 建议使用API​​进行身份验证的方法是通过服务帐户。

Another option is to use OAuth2.0. 另一种选择是使用OAuth2.0。

So How can I use Service Account Authentication in Android App or OAuth2.0 is the only option? 那么,如何在Android App中使用服务帐户身份验证或OAuth2.0是唯一的选择?

Also, suggest if there is any other way to achieve this with concise and compact code. 另外,建议是否还有其他简洁的代码来实现此目的。

In most cases, the recommendation is to have your application communicate to a backend server that handles the requests and their authentication to GCP. 在大多数情况下,建议使您的应用程序与处理请求及其对GCP的身份验证的后端服务器进行通信。 This will allow to have a better control and security of your Project and you can just follow the recommendations for setting up authentication for server to server production applications . 这样可以更好地控制您的项目并提高其安全性,您可以按照建议为服务器到服务器生产应用程序设置身份验证

If you really want to authenticate as an end user, then for Production scenarios the best option is to use OAuth 2.0, which allows your application to access resources on behalf of a user, setting the proper scopes. 如果您确实想作为最终用户进行身份验证,那么对于生产方案,最好的选择是使用OAuth 2.0,它允许您的应用程序代表用户访问资源并设置适当的范围。 Check this documentation to learn more about how to use OAuth 2.0 for Mobile & Desktop Apps. 查看此文档以了解有关如何将OAuth 2.0用于移动和桌面应用程序的更多信息。

Alternatively, you could use API keys, but you have to be careful and restrict the API keys to your specific Android Apps and other proper restrictions in order to avoid misuse. 另外,您可以使用API​​密钥,但是您必须小心并将API密钥限制在您的特定Android Apps和其他适当的限制内,以避免滥用。 Also, you would have to follow other best practices such as reviewing your code before publicly releasing it in order to ensure that your code does not contain API keys. 此外,您还必须遵循其他最佳做法,例如在公开发布代码之前检查代码,以确保您的代码不包含API密钥。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM