ServerStorage.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:what-i-read 作者:
private void initAuthCookie(Activity source, ServerPreferences conf)
        throws OperationCanceledException, AuthenticatorException,
        IOException {

    Account account = conf.getAccount();

    if (account == null) {
        return;
    }

    String authToken = buildToken(source, account);

    HttpURLConnection tempGet = (HttpURLConnection) new URL(
            conf.getServerURL()
                    + "_ah/login?continue=http://localhost/&auth="
                    + URLEncoder.encode(authToken)).openConnection();

    int responseCode = tempGet.getResponseCode();
    if (responseCode != HttpURLConnection.HTTP_OK
            && responseCode != HttpURLConnection.HTTP_MOVED_TEMP) {
        throw new AuthenticatorException(
                "Could not exchange token for cookie, code: "
                        + responseCode);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号