简体   繁体   English

Github与会话的Java身份验证:最好的方法是什么?

[英]Github java auth with session: what is best way?

I tried to use some Java api libraries. 我尝试使用一些Java api库。 But I didn't understand how get token and expires, when I login to Github. 但是当我登录到Github时,我不明白如何获取令牌和过期。 For example 例如

RepositoryService service = new RepositoryService();
service.getClient().setCredentials("user", "passw0rd");

And how get token or session expires? 以及令牌或会话如何过期? I want to autoauth next time 我下次要自动验证

I think you might be better off with Github's OAuth authentication mechanism. 我认为使用Github的OAuth身份验证机制可能会更好。

With OAuth your application can request a long lived access token that can be used to access resources on the users behalf until the user revokes the permission. 使用OAuth,您的应用程序可以请求一个长期存在的访问令牌,该令牌可以用来代表用户访问资源,直到用户撤销许可为止。

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

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