GithubHelp home page GithubHelp logo

mrivanplays / jdoa2 Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 50 KB

Discord OAuth2 API wrapper for Java, for creating apps using discord account as authentication.

License: MIT License

Java 100.00%

jdoa2's Introduction

license issues support version

JDOA2

Discord OAuth2 API wrapper for Java, for creating apps using discord account as authentication.

Information

Important thing to know is that the library only supports discord scopes "identify, guilds, email".

Please see ApplicationInfo#getAuthCode to understand how actually to implement your discord application with this library.

Installation

Installing JDOA2 is just like every other dependency:

Maven:

    <repositories>
       <repository>
           <id>ivan</id>
           <url>https://repo.mrivanplays.com/repository/ivan/</url>
       </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.mrivanplays</groupId>
            <artifactId>jdoa2</artifactId>
            <version>VERSION</version> <!-- Replace with latest version -->
            <scope>compile</scope>
        </dependency>
    </dependencies>

Gradle:

repositories {
    maven {
        url "https://repo.mrivanplays.com/repository/ivan/"
    }
}

dependencies {
    implementation 'com.mrivanplays:jdoa2:VERSION' // Replace VERSION with latest version
}

Usage

Example spring controller:

@Controller
public class TestController {


    @GetMapping("/")
    public ResponseEntity<CurrentUser> render(@RequestParam(value = "code", required = false, defaultValue = "") String authCode) {
        if (authCode.isEmpty()) {
            return ResponseEntity.ok(
                    new CurrentUser("0", "unknown", "unknown", "unknown",
                            false, false, false, "unknown", "unknown", 0)
            );
        }
        JDOA2 jdoa2 = JDOA2.builder()
                .applicationInfo(
                        ApplicationInfo.builder()
                                .clientId("exampleClientId")
                                .clientSecret("exampleClientSecret")
                                .redirectUri("http://exampleRedirect.uri/")
                                .authCode(authCode)
                                .build()
                )
                .build();
        jdoa2.doTokenExchange();
        return ResponseEntity.ok(jdoa2.getCurrentUser().execute());
    }
}

Javadocs

Can be found here

jdoa2's People

Contributors

dependabot[bot] avatar mrivanplays avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.