Closed shuzijun closed 4 years ago
It is really difficult to bypass Recaptcha verification by programming. As far as I know, one of the solutions is open a separate/embeded browser window and ask user to login manually. After successfully login, the response information including session id is loaded into the program. I am not sure if you can make the plugin work in this way. I've been using your plugin for a long time. Thank you for developing such excellent tool. Hope you will address this problem soon. Appreciate your effort on this issue.
Can users login on web then copy token to plugin configurations, then your plugin uses that token directly?
@hdlldh I have tried to log in using javaFx WebView, but unfortunately, it cannot pass the authentication normally. Possible cause: content-security-policy
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker.State;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class Demo extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
/* java.net.CookieManager manager = new java.net.CookieManager();
java.net.CookieHandler.setDefault(manager);*/
WebView browser = new WebView();
WebEngine webEngine = browser.getEngine();
webEngine.setUserAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36");
webEngine.setJavaScriptEnabled(true);
com.sun.javafx.webkit.WebConsoleListener.setDefaultListener(
(webView, message, lineNumber, sourceId) -> System.out.println("Console: [" + sourceId + ":" + lineNumber + "] " + message)
);
webEngine.getLoadWorker().stateProperty().addListener(
new ChangeListener<State>() {
public void changed(ObservableValue ov, State oldState, State newState) {
if (newState == State.SUCCEEDED) {
System.out.println(webEngine.locationProperty().toString());
}
}
});
webEngine.load("https://leetcode.com/accounts/login/");
StackPane root = new StackPane();
root.getChildren().add(browser);
primaryStage.setScene(new Scene(root, 600, 600));
primaryStage.show();
}
public static void main(String[] args) {
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
launch(args);
}
}
Also having this issue, thought it may be related to the new intellij version, but looks to be this additional factor of login.
@shuzijun I successfully logged in using JavaFX WebView, if you need, I will make a PR lately.
@fondoger Thank you for your contribution
I successfully logged in using JavaFX WebView, if you need, I will make a PR lately.
@fondoger do you have the fix in a fork? I am hoping to fix the issue locally for myself while the official release gets updated
@shuzijun @AhmedCh Dear friends, I found that it may not a good solution to use JavaFX WebView to get cookies. Due to the lack of customization of javaFx WebView, I can't set headers to make it behave like a normal web browser. The Google reCAPTCHA will always require me to do human tests. Yestoday I could log in using third party account like GitHub, but today I found my account seems to be banned due to too many abnormal logging in.
I uploaded my work to my GitHub repository. The key part is https://github.com/fondoger/leetcode-editor/commit/99ffe06ab51af813e2a99c13d2f949334ec4f147#diff-1290c8fc24ac38b4a62259f0e2f1bb97.
Let plugin users set cookies manually for US leetcode website may be a practicable solution.
Test solutio, Download link:
Sorry, I only have Baidu Drive, download is not friendly
branch:https://github.com/shuzijun/leetcode-editor/tree/gradle
Tested mac version and got "login err: natives Path is empty" when I clicked login icon.
I extract the zip to C:\Users\?????\.IdeaIC2019.3\config\plugins\leetcode-editor, but not work...
@dongfang-a Try using Install Plugin from Disk,https://www.jetbrains.com/help/idea/plugins-settings.html
Tested. Mac version, "login err: natives Path is empty". @shuzijun
@tian-x Unfortunately, the dependent pandomium does not support mac
@shuzijun I saw Pandomium has MacOS build. Does it still not work? https://github.com/dzikoysk/Pandomium/wiki/macOS-Build
@hdlldh Does not seem to support:https://github.com/dzikoysk/pandomium/issues/2#issuecomment-490041503
i still can not login in ... information: 1.os macos 10.14.3 2.ide goland 2018.3.4
In vscode, you can use npm to install leetcode-cli to get cookies, and then log in to leetcode. You can read cookies in the plugin. see leetcode-cli
In vscode, you can use npm to install leetcode-cli to get cookies, and then log in to leetcode. You can read cookies in the plugin. see leetcode-cli
@tydic-kanper The leetcode-cli has same issues. See: https://github.com/skygragon/leetcode-cli/issues
Tested mac version and it worked!! Thank you!! @shuzijun
@shuzijun Tested mac version on IntelliJ and it worked perfectly. You are amazing. Thank you for your effort on fixing this issue.
@shuzijun Tested mac version on PyCharm and it caused PyCharm to quit unexpectedly when I clicked login icon. Pycharm version: 2019.3.
Hey, I am not able to log in. I am using Clion and ubuntu 18.04
@shuzijun I'm not able to download the plugin from mac url provided
I downloaded the latest version from here and it worked. https://github.com/shuzijun/leetcode-editor/releases/tag/v6.0-beta.1 Thank you! Intellij Ultimate: 2019.3 Mac
Could we just put the session ID input somewhere in the plugin setting page? We can login in browser and paste the session id manually as a temporarily work around
That shall be a good idea, if nothing else work.
Here's the summary to get the problem solved in OSX:
Uninstall leetcode-editor.
Goto https://github.com/shuzijun/leetcode-editor/releases/tag/v6.0-beta.1 Download "leetcode-editor-V5.4.zip" and install plugin, click on the login button will give you an error "natives Path is empty,path: ....../natives", open that path (it's your plugin directory/leetcode-editor/natives)
Goto https://github.com/shuzijun/leetcode-editor/releases/tag/v6.0-jcef-beta.1 Download "natives-mac.zip" and extract jcef_app.app to that path.
Restart IDEA.
Could we just put the session ID input somewhere in the plugin setting page? We can login in browser and paste the session id manually as a temporarily work around
This solution is being considered, JCEF compatibility test results are poor
Hi, thanks for this great software, this issue still exsits so far on my computer: OS: Ubuntu 16.04 Intelliji: IntelliJ IDEA 2019.3.1 (Ultimate Edition)
Could you please noify us when you solved this issue? Thanks!
@Kelvinson The new version has solved this problem. v6.0.
Login help reference LoginHelp.md
@shuzijun Hi shuzijun, thanks for your quick reply, it works perfectly after I download the v6.0 release and manually install it! It would be great if you can update the plugin on the jetbrain marketplace to the latest version so others don't need to solve the login problem manually.
By the way how can I modify the default package name so it' s not leetcode.editor.en but it's just leetcode , thank you very much and wish you a best new year!
@Kelvinson Due to the operation to delete all files in the folder, in order to prevent the deletion of important files, this path cannot be modified
Got you, thank you very much!
Updated via IJ Marketplace but seems OSX still not working. Went back to https://github.com/shuzijun/leetcode-editor/releases/tag/v6.0-beta.1 along with https://github.com/shuzijun/leetcode-editor/releases/tag/v6.0-jcef-beta.1 and worked again.
Due to the recaptcha verification code added during login, login is currently not possible and a solution is being sought. Have relevant experience and need your help.