Elixir library for the Battle.net API.
Add battlenet
to your list of dependencies in mix.exs
:
def deps do
[{:battlenet, "~> 0.0.2"}]
end
And add to your application list in mix.exs
:
def application do
[applications: [:battlenet]]
end
You will need to provide your client_id
, client_secret
, and redirect_uri
.
The client_id
and client_secret
can be found on the My API Keys page,
and redirect_uri
is the one you provided when you created your battle.net
application.
It's recommended that you create a secret configuration file that you don't
check into source control to provide your client_id
and client_secret
.
# config.exs
use Mix.Config
config :battlenet,
redirect_uri: "your-redirect-uri", # required
api_site_url: "override", # optional, defaults to <region>.api.battle.net
region: "override", # optional, defaults to eu
site_url: "override" # optional, defaults to <region>.battle.net
import_config "config.secret.exs"
# config.secret.exs
use Mix.Config
config :battlenet,
client_id: "your-client-id", # required
client_secret: "your-client-secret", # required
It's worth reading Blizzard's OAuth Documentation to get familiar with how it works.
- OAuth interactions
- Authorization URL
- Access token
- Scopes
- State verification
- API
- User profile (for Battle.net ID and Battletag)
- Flexible API requests (any endpoint)
See LICENSE.md.