Incorrect server redirection uri fix

This commit is contained in:
Logan Hunt 2023-01-31 17:01:02 -07:00
parent 387ac72d1b
commit f05daabe0d
No known key found for this signature in database
GPG Key ID: 8AC6A4B840C0EC49
3 changed files with 6 additions and 3 deletions

View File

@ -12,6 +12,7 @@ REACT_APP_DISCORD_INVITE=https://discord.gg/ajsdlkfjaskldjf
REACT_APP_DISCORD_OAUTH=https://discord.com/api/oauth2/authorize?client_id=CLIENT_ID&redirect_uri=FRONTEND_REDIRECT_PORT_FROM_BELOW&response_type=code&scope=identify
CLIENT_REDIRECT_AFTER_OAUTH=http://127.0.0.1:3000/auth-successful
SERVER_REDIRECT_URI=http://127.0.0.1:3000/api/oauth/redirect
DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=

View File

@ -8,7 +8,9 @@ config :chessh, Web,
discord_client_secret: System.get_env("DISCORD_CLIENT_SECRET"),
discord_user_agent: System.get_env("DISCORD_USER_AGENT"),
client_redirect_after_successful_sign_in:
System.get_env("CLIENT_REDIRECT_AFTER_OAUTH", "http://127.0.0.1:3000/oauth-successfule"),
System.get_env("CLIENT_REDIRECT_AFTER_OAUTH", "http://127.0.0.1:3000/auth-successful"),
server_redirect_uri:
System.get_env("SERVER_REDIRECT_URI", "http://127.0.0.1:3000/api/oauth/redirect"),
port: String.to_integer(System.get_env("WEB_PORT", "8080"))
config :joken,

View File

@ -32,7 +32,7 @@ defmodule Chessh.Web.Endpoint do
case :httpc.request(
:post,
{String.to_charlist(discord_login_url), [], 'application/x-www-form-urlencoded',
'scope=#{discord_scope}&client_id=#{client_id}&client_secret=#{client_secret}&code=#{req_token}&grant_type=authorization_code&redirect_uri=#{redirect_uri}'},
'scope=#{discord_scope}&client_id=#{client_id}&client_secret=#{client_secret}&code=#{req_token}&grant_type=authorization_code&redirect_uri=http://127.0.0.1:3000/api/oauth/redirect'},
[],
[]
) do
@ -214,7 +214,7 @@ defmodule Chessh.Web.Endpoint do
:discord_client_secret,
:discord_user_api_url,
:discord_user_agent,
:client_redirect_after_successful_sign_in
:server_redirect_uri
],
fn key -> Application.get_env(:chessh, Web)[key] end
)