Skip to content

Commit

Permalink
fix(pcm): redirect uri was incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancurrah committed Jan 3, 2021
1 parent 987487b commit b5ac0ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/smartdevicemanagement_exporter/main.go
Expand Up @@ -68,6 +68,7 @@ func main() {
AuthorizationCodeChan: authorizationCodeChan,
ClientID: config.ClientID,
ProjectID: *pid,
AuthorizedPath: "/authorized",
}

sdme := smartdevicemanagementexporter.SmartDeviceManagementExporter{
Expand Down
7 changes: 5 additions & 2 deletions partnerconnmanager/partnerconnmanager.go
Expand Up @@ -22,6 +22,7 @@ type PartnerConnManager struct {
AuthorizationCodeChan chan AuthorizationCode
ClientID string
ProjectID string
AuthorizedPath string
}

func (p *PartnerConnManager) AuthorizeHandler(w http.ResponseWriter, r *http.Request) {
Expand All @@ -39,6 +40,8 @@ func (p *PartnerConnManager) AuthorizeHandler(w http.ResponseWriter, r *http.Req
return
}

uri.Path = p.AuthorizedPath

v := url.Values{
"access_type": {"offline"},
"prompt": {"consent"},
Expand Down Expand Up @@ -70,6 +73,8 @@ func (p *PartnerConnManager) AuthorizedHandler(w http.ResponseWriter, r *http.Re
return
}

uri.Path = r.URL.Path

p.AuthorizationCodeChan <- AuthorizationCode{Code: code, RedirectURI: uri.String()}

fmt.Fprint(w, "authorization code received from partner connection manager")
Expand All @@ -86,7 +91,5 @@ func redirectURI(r *http.Request) (*url.URL, error) {
return nil, err
}

u.Path = r.URL.Path

return u, nil
}

0 comments on commit b5ac0ed

Please sign in to comment.