1
0
mirror of https://github.com/mgerb/classic-wow-forums synced 2026-01-11 01:22:49 +00:00
This commit is contained in:
2017-12-31 20:19:44 -06:00
commit e856cc5172
37 changed files with 1196 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
defmodule MyAppWeb.BattleNetController do
use MyAppWeb, :controller
alias MyAppWeb.Response
alias MyApp.BattleNet.Auth
# https://us.battle.net/oauth/authorize?redirect_uri=https://localhost/api/battlenet/authorize&scope=wow.profile&client_id=vxqv32fddxsy6cmk6259amtymbuzmfrq&response_type=code
def authorize(conn, %{"code" => code}) when not is_nil(code) do
{output, status} = case Auth.get_token(code) do
{:ok, token} -> {token, 200}
{:error, err} -> {err, 400}
end
conn
|>put_status(status)
|>Response.json(output)
end
end