Skip to content

Conversation

@MeidoNoHitsuji
Copy link

No description provided.

}

public static DiscordAccessTokenResponse sendRefreshToken(String refreshToken) throws IOException {
Connection request = Jsoup.connect(config.discordApiEndpointVersion + "/oauth2/token")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Используйте HttpHelper, HttpRequester или напрямую Java 11+ Http API вместо jsoup

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я пытался использовать HttpHelper.. Но там чтобы ссылку собрать для "Content-type: x-www-form-urlencoded" приходится костылить.. А для того, чтобы респонс разобрать так вообще танцы с бубном нужны, ибо HttpHelper у мня ни в какую не хотел разбирать её..

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я пытался использовать HttpHelper.. Но там чтобы ссылку собрать для "Content-type: x-www-form-urlencoded" приходится костылить.. А для того, чтобы респонс разобрать так вообще танцы с бубном нужны, ибо HttpHelper у мня ни в какую не хотел разбирать её..

Посмотрите реализацию метода http и модуля simplecabinet

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я пытался использовать HttpHelper.. Но там чтобы ссылку собрать для "Content-type: x-www-form-urlencoded" приходится костылить.. А для того, чтобы респонс разобрать так вообще танцы с бубном нужны, ибо HttpHelper у мня ни в какую не хотел разбирать её..

Попробуйте использовать этот или этот метод.

@gravit0
Copy link
Collaborator

gravit0 commented Jun 23, 2022

Хорошо бы вам вместо копирования кода расширить MySQLAuthCoreProvider

@MeidoNoHitsuji
Copy link
Author

  1. Я не знаю как правильно его расширить, ибо это всё же другой тип авторизации :c
  2. По задумке хранение токенов будет доступно не только в mysql, но и любой другой хранилке.. Вот только как правильно переиспользовать вторую стороннюю авторизацию на сервере я так и не придумал :c

@gravit0
Copy link
Collaborator

gravit0 commented Jun 23, 2022

  1. Я не знаю как правильно его расширить, ибо это всё же другой тип авторизации :c

    1. По задумке хранение токенов будет доступно не только в mysql, но и любой другой хранилке.. Вот только как правильно переиспользовать вторую стороннюю авторизацию на сервере я так и не придумал :c

Если у вас таблицы одинаковые и новые поля вы не добавляете то вам достаточно переопределить authorize, refreshToken и getUserByOAuthAccessToken.

@MeidoNoHitsuji
Copy link
Author

Вот в том то и дело, что таблицы разные, а в модуля БД всё работает на голых запросах :c

.../scenes/login/methods/WebAuthMethod.java | 31 ++++++++++++++-----
3 files changed, 47 insertions(+), 10 deletions(-)

diff --git a/src/main/java/pro/gravit/launcher/client/gui/impl/GuiEventHandler.java b/src/main/java/pro/gravit/launcher/client/gui/impl/GuiEventHandler.java
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Патч нужно внести в репозиторий рантайма отдельным PR

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Но зачем? Не думаю, что фикс с onlyBrowser у меня правильно работает (webView в лаунчере появляется и сразу исчезает), так что какой смысл сливать костыль, который сделан только для данного модуля, в основной репозиторий?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделайте так что бы он не был костыльным

- if(code.startsWith("?code=")) {
- code = r.substring("?code=".length(), r.indexOf("&"));
+ if (details.onlyBrowser) {
+ if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Класс Desktop не является частью JavaFX. Используйте функцию открытия url из application

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это какая функция? И вы же не имеете ввиду открытие окна браузера в самом лаунчере?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openURL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants