Before authorizing a user, you need to create an application and set
redirect_uriSee Creating an application for applications setup.
The application editor includes a URL generator. It builds an authorization URL from:
Open that generated URL in the user browser to start the authorization.
You must add an additional parameter to the url generated: state, it’s a value you define yourself that you can use to properly authenticate users being redirected to your application after a sucessful authorization.
The authorization request only grants access to the scopes your application requests and the user approves.
The currently exposed scopes are:
identifymain_accesscharacter_list_accesscharacter_data_accesscharacter_build_accessonline_statushunted_characters_accessguild_history_accessguild_high_ranked_accessOnly request the scopes your application needs.
After a user authorizes your application, they will be redirected to the redirect_uri you provided in the authorization url,
that redirect will also cary two query parameters, code and state.
code is the Authorization code, you will need to provide it to POST /oauth/token to generate an access tokenstate is the initial untouched value you added to the authorization url, used to determine who has authorized your appAuthorization codes are one-time use and expire after 5 minutes.
Public applications must use PKCE.
Wynncraft only supports the S256 PKCE method.
For public applications:
code_verifiercode_verifier to get your code_challenge using S256code_challenge and code_challenge_method (must be S256) values in the authorization urlcode_verifier for later, you will need it to generate an access token using POST /oauth/tokenYou can use PKCE for a private application, but it is optional as private applications rely on their client_secret.
For Private applications:
client_secret on POST /oauth/token to retrieve an access tokenIf an error occurs during the authorization, the user will be redirected to your redirect_uri alongside query parameters:
errorerror_descriptionstate