gpt4 book ai didi

Android AccountAuthenticator 和 OAuth2

转载 作者:搜寻专家 更新时间:2023-11-01 09:13:03 25 4
gpt4 key购买 nike

我正在使用使用 OAuth2 身份验证的 Windows Live 服务开发 Android 应用程序,因此我无权访问用户密码。我想将用户帐户添加到 Android 帐户管理器,但由于我无权访问用户密码,因此坚持使用帐户管理器的默认流程是一个问题,即如果授权重新登录用户 token 不再有效。是否有人构建了一个 Android 应用程序,该应用程序使用客户经理提供使用 OAUth2 进行验证的服务?如果是这样,您是如何处理的?

最佳答案

这当然是可行的。来自安卓AccountManager文档:

Many servers support some notion of an authentication token, which can be used to authenticate a request to the server without sending the user's actual password. (Auth tokens are normally created with a separate request which does include the user's credentials.) AccountManager can generate auth tokens for applications, so the application doesn't need to handle passwords directly. Auth tokens are normally reusable and cached by AccountManager, but must be refreshed periodically. It's the responsibility of applications to invalidate auth tokens when they stop working so the AccountManager knows it needs to regenerate them.

关于Android AccountAuthenticator 和 OAuth2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6859953/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com