我开发的应用程序需要对服务器实施OAuth2.0身份验证和用户管理。我尝试遵循此https://developer.android.com/training/id-auth/authenticate和许多其他答案,但实际上无法理解如何指定正文和标题。我可以使用Volley得到答复,但是那时没有帐户管理。 任何人都可以展示如何执行代码中的功能。我要使用一些图书馆吗?
以下信息已由服务器管理员及其在邮递员中的工作提供:
获取新令牌
URL: http://17.22.168.112:2015/to1kenr
Body
username: david.m
password: temp123
appid:0axx2241-2cf9-9845-6974-978c55f57mn5
grant_type:password
Header
Content-Type:application/x-www-form-urlencoded
Authorization:BASIC ODc2MTQ3NjU4MjU0MTQ1NjU0OlNFUlYx
使用刷新令牌获取令牌
URL: http://17.22.168.112:2015/to1kenr
Body
grant_type:refresh_token
appid: 0axx2241-2cf9-9845-6974-978c55f57mn5
refresh_token: enter the refresh token
Header
Content-Type:application/x-www-form-urlencoded
Authorization:BASIC ODc2MTQ3NjU4MjU0MTQ1NjU0OlNFUlYx