-
Notifications
You must be signed in to change notification settings - Fork 60
[FEATURE] Модуль авторизации через Discord #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[FEATURE] Модуль авторизации через Discord #53
Conversation
...AuthSystem_module/src/main/java/pro/gravit/launchermodules/discordauthsystem/ModuleImpl.java
Outdated
Show resolved
Hide resolved
DiscordAuthSystem_module/src/main/java/pro/gravit/launchermodules/discordauthsystem/WebApi.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| public static DiscordAccessTokenResponse sendRefreshToken(String refreshToken) throws IOException { | ||
| Connection request = Jsoup.connect(config.discordApiEndpointVersion + "/oauth2/token") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 у мня ни в какую не хотел разбирать её..
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...va/pro/gravit/launchermodules/discordauthsystem/providers/DiscordSystemAuthCoreProvider.java
Outdated
Show resolved
Hide resolved
...va/pro/gravit/launchermodules/discordauthsystem/providers/DiscordSystemAuthCoreProvider.java
Outdated
Show resolved
Hide resolved
...va/pro/gravit/launchermodules/discordauthsystem/providers/DiscordSystemAuthCoreProvider.java
Outdated
Show resolved
Hide resolved
|
Хорошо бы вам вместо копирования кода расширить MySQLAuthCoreProvider |
|
Если у вас таблицы одинаковые и новые поля вы не добавляете то вам достаточно переопределить authorize, refreshToken и getUserByOAuthAccessToken. |
|
Вот в том то и дело, что таблицы разные, а в модуля БД всё работает на голых запросах :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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Патч нужно внести в репозиторий рантайма отдельным PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Но зачем? Не думаю, что фикс с onlyBrowser у меня правильно работает (webView в лаунчере появляется и сразу исчезает), так что какой смысл сливать костыль, который сделан только для данного модуля, в основной репозиторий?
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Класс Desktop не является частью JavaFX. Используйте функцию открытия url из application
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это какая функция? И вы же не имеете ввиду открытие окна браузера в самом лаунчере?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
openURL
No description provided.