Cleanup oauth redirect URL generation
This commit is contained in:
parent
d297eb5658
commit
c7f40c1e15
|
@ -859,6 +859,7 @@ func (s *service) NewSession(c *client, instance string) (rurl string, sess *mod
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
rurl = app.AuthURI
|
||||||
sess = &model.Session{
|
sess = &model.Session{
|
||||||
ID: sid,
|
ID: sid,
|
||||||
Instance: instance,
|
Instance: instance,
|
||||||
|
@ -867,20 +868,6 @@ func (s *service) NewSession(c *client, instance string) (rurl string, sess *mod
|
||||||
CSRFToken: csrf,
|
CSRFToken: csrf,
|
||||||
Settings: *model.NewSettings(),
|
Settings: *model.NewSettings(),
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := url.Parse("/oauth/authorize")
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
q := make(url.Values)
|
|
||||||
q.Set("scope", "read write follow")
|
|
||||||
q.Set("client_id", app.ClientID)
|
|
||||||
q.Set("response_type", "code")
|
|
||||||
q.Set("redirect_uri", s.cwebsite+"/oauth_callback")
|
|
||||||
u.RawQuery = q.Encode()
|
|
||||||
|
|
||||||
rurl = instanceURL + u.String()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue