diff --git a/ui/controllers/pco.go b/ui/controllers/pco.go index 6d5c921..ab7324c 100644 --- a/ui/controllers/pco.go +++ b/ui/controllers/pco.go @@ -2,6 +2,7 @@ package controllers import ( "encoding/json" + "fmt" "io" "net/http" "net/url" @@ -13,7 +14,7 @@ import ( "github.com/gin-gonic/gin" ) -const PCO_REDIRECT_URI = "https://capstone.preston-baxter.com:8080/vendor/pco/callback" +const PCO_REDIRECT_URI = "https://%s/vendor/pco/callback" func InitiatePCOOuath(c *gin.Context) { conf := config.Config() @@ -27,7 +28,7 @@ func InitiatePCOOuath(c *gin.Context) { q := init_url.Query() q.Add("client_id", vendorConfig.ClientId) - q.Add("redirect_uri", PCO_REDIRECT_URI) + q.Add("redirect_uri", fmt.Sprintf(PCO_REDIRECT_URI, conf.AppSettings.FrontendServiceUrl)) q.Add("response_type", "code") q.Add("scope", vendorConfig.Scope()) init_url.RawQuery = q.Encode() @@ -67,7 +68,7 @@ func RecievePCOOuath(c *gin.Context) { q.Add("code", code) q.Add("client_id", vendorConfig.ClientId) q.Add("client_secret", vendorConfig.ClientSecret) - q.Add("redirect_uri", PCO_REDIRECT_URI) + q.Add("redirect_uri", fmt.Sprintf(PCO_REDIRECT_URI, conf.AppSettings.FrontendServiceUrl)) q.Add("grant_type", "authorization_code") req, err := http.NewRequest("POST", token_url.String(), strings.NewReader(q.Encode())) diff --git a/ui/controllers/youtube.go b/ui/controllers/youtube.go index 8e63bb1..53a5458 100644 --- a/ui/controllers/youtube.go +++ b/ui/controllers/youtube.go @@ -2,6 +2,7 @@ package controllers import ( "encoding/json" + "fmt" "io" "net/http" "net/url" @@ -13,7 +14,7 @@ import ( "github.com/gin-gonic/gin" ) -const YOUTUBE_REDIRECT_URI = "https://capstone.preston-baxter.com:8080/vendor/youtube/callback" +const YOUTUBE_REDIRECT_URI = "https://%s/vendor/youtube/callback" func InitiateYoutubeOuath(c *gin.Context) { conf := config.Config() @@ -28,7 +29,7 @@ func InitiateYoutubeOuath(c *gin.Context) { q := init_url.Query() //https://developers.google.com/youtube/v3/guides/auth/server-side-web-apps#httprest_1 q.Add("client_id", vendorConfig.ClientId) - q.Add("redirect_uri", YOUTUBE_REDIRECT_URI) + q.Add("redirect_uri", fmt.Sprintf(YOUTUBE_REDIRECT_URI, conf.AppSettings.FrontendServiceUrl)) q.Add("response_type", "code") q.Add("scope", vendorConfig.Scope()) q.Add("access_type", "offline") @@ -79,7 +80,7 @@ func ReceiveYoutubeOauth(c *gin.Context) { q.Add("code", code) q.Add("client_id", vendorConfig.ClientId) q.Add("client_secret", vendorConfig.ClientSecret) - q.Add("redirect_uri", YOUTUBE_REDIRECT_URI) + q.Add("redirect_uri", fmt.Sprintf(YOUTUBE_REDIRECT_URI, conf.AppSettings.FrontendServiceUrl)) q.Add("grant_type", "authorization_code") req, err := http.NewRequest("POST", token_url.String(), strings.NewReader(q.Encode())) diff --git a/versions.json b/versions.json index 1110b03..3c34152 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,4 @@ { - "webhook_version": "0.0.19", - "frontend_version": "0.0.19" + "webhook_version": "0.0.20", + "frontend_version": "0.0.20" }