Authorizing an application
Before you start
Before authorizing a user, you need to create an application and set
- at least one
redirect_uri - the scopes you want to request
See Creating an application for applications setup.
Using the generated authorization URL
The application editor includes a URL generator. It builds an authorization URL from:
- your application ID
- the selected redirect URI
- the scopes enabled for the application
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.
Scopes
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_access
Only request the scopes your application needs.
Access Token Generation
Authorization Code
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.
codeis the Authorization code, you will need to provide it to POST /oauth/token to generate an access tokenstateis the initial untouched value you added to the authorization url, used to determine who has authorized your app
Authorization codes are one-time use and expire after 5 minutes.
Public applications and PKCE
Public applications must use PKCE.
Wynncraft only supports the S256 PKCE method.
For public applications:
- generate a
code_verifier - encore and hash
code_verifierto get yourcode_challengeusingS256 - include the
code_challengeandcode_challenge_method(must beS256) values in the authorization url - keep the
code_verifierfor later, you will need it to generate an access token using POST /oauth/token
You can use PKCE for a private application, but it is optional as private applications rely on their client_secret.
Private applications
For Private applications:
- authorize the user
- provide the application’s
client_secreton POST /oauth/token to retrieve an access token
Note
If an error occurs during the authorization, the user will be redirected to your redirect_uri alongside query parameters:
errorerror_descriptionstate
