JnCrMx / discord-game-sdk4j

Java bindings for Discord's Game SDK
MIT License
123 stars 23 forks source link

Invalid permissions response error and networking thing #86

Open magnemint opened 5 months ago

magnemint commented 5 months ago

hi i get this error

[ERROR] ResponseError { code: InvalidPermissions, message: "Not authenticated or invalid scope" }
[ERROR] ResponseError { code: UnknownError, message: "Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc." }
[ERROR] Failed to configure networking: ResponseError { code: UnknownError, message: "Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc." }

with this code

ublic class Main {
    static File file = null;
    static String path = "lib/rpc_lib/x86_64/discord_game_sdk.dll";

    public static void main(String[] args) {
        file = new File(path);
        Core.init(file);
        try(CreateParams params = new CreateParams()) {
            params.setClientID(1252977240413700137L);
            params.setFlags(CreateParams.getDefaultFlags());

            // Create the Core
            try (Core core = new Core(params))
            {
                try(Activity activity = new Activity())
                {
                    activity.setDetails("Running an example");
                    activity.setState("and having fun");

                    // Setting a start time causes an "elapsed" field to appear
                    activity.timestamps().setStart(Instant.now());

                    // We are in a party with 10 out of 100 people.
                    activity.party().size().setMaxSize(100);
                    activity.party().size().setCurrentSize(10);

                    // Make a "cool" image show up
                    activity.assets().setLargeImage("test");

                    // Setting a join secret and a party ID causes an "Ask to Join" button to appear
                    activity.party().setID("Party!");
                    activity.secrets().setJoinSecret("Join!");

                    // Finally, update the current activity to our activity
                    core.activityManager().updateActivity(activity);
                }

                while(true)
                {
                    core.runCallbacks();
                    try
                    {
                        // Sleep a bit to save CPU
                        Thread.sleep(16);
                    }
                    catch(InterruptedException e)
                    {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
}

ive configured the discord application on the developer portal and i get a networking error i dont know where it came from please help

magnemint commented 5 months ago

i would just like to say that i looked at other issues and got the rich presence (my goal) to work but i still get the responseerrors and I would like to suppress them because yes so if anyone could please help i would appreciate it

JnCrMx commented 5 months ago

Hi,

this is probably because networking is no longer supported, but the library still attempts to initialize it.

It will be fixed in the next update (which is the rewrite in pure Java and does not contain networking support anymore).