- Notifications
You must be signed in to change notification settings - Fork 111
[Feature] OAuth 2 #53
Conversation
| CURRENT_USER("/users/@me"), | ||
| CURRENT_USER_GUILDS("/users/@me/guilds"); | ||
| // We always use the same rest version as JDA | ||
| public static final String BASE_API_URL = String.format("https://discordapp.com/api/v%d", JDAInfo.DISCORD_REST_VERSION); |
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.
This is dangerous as JDA's rest version can change without notice
| Can I volunteer to test this? |
Update OAuth2 branch
| { | ||
| obj = body.getJSONObject(i); | ||
| list.add(new OAuth2GuildImpl(OAuth2ClientImpl.this, obj.getLong("id"), | ||
| obj.getString("name"), obj.getString("icon"), obj.getBoolean("owner"), |
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.
Isn't it better to use obj.optString("icon", nul) because the server icon can be null and it will throw this error:
org.json.JSONException: JSONObject["icon"] not a string. at org.json.JSONObject.getString(JSONObject.java:810) at com.jagrosh.jdautilities.oauth2.entities.impl.OAuth2ClientImpl$3.handle(OAuth2ClientImpl.java:185) at com.jagrosh.jdautilities.oauth2.entities.impl.OAuth2ClientImpl$3.handle(OAuth2ClientImpl.java:165) at com.jagrosh.jdautilities.oauth2.requests.OAuth2Requester.submitSync(OAuth2Requester.java:95) at com.jagrosh.jdautilities.oauth2.requests.OAuth2Action.complete(OAuth2Action.java:147) 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.
Fixed with merge of #67
Thanks for the help @duncte123! 😃
* Use optString for the guild icon because it can be null * Use null as default
…A-Applications/JDA-Utilities into feature/oauth2 # Conflicts: # settings.gradle
…A-Applications/JDA-Utilities into feature/oauth2 # Conflicts: # settings.gradle
Change file extension of guild icon to reflect jda's change
| This branch is currently 100% broken due to discord requiring the params for the token request to be set as post fields instead of get params, will be fixed when #92 is merged |
Update oauth2 to JDAv4
| Since this still has the "needs testing" label I'd like to say that I've been running this branch for a while now in production and it's been working fine, it can be seen in action over here |
No description provided.