Skip to content

Commit a8ed467

Browse files
committed
refactor: rename func arg, fix auth code grant
1 parent cfec49a commit a8ed467

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: goic.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ func (g *Goic) checkState(state string) (string, error) {
165165

166166
// Authenticate tries to authenticate a user by given code and nonce
167167
// It is where token is requested and validated
168-
func (g *Goic) Authenticate(p *Provider, code, nonce, curl string) (*Token, error) {
168+
func (g *Goic) Authenticate(p *Provider, code, nonce, redir string) (*Token, error) {
169169
if !g.Supports(p.Name) {
170170
return &Token{Provider: p.Name}, ErrProviderSupport
171171
}
172172

173-
tok, err := g.getToken(p, code, curl)
173+
tok, err := g.getToken(p, code, redir, "authorization_code")
174174
if err != nil {
175175
return tok, err
176176
}
@@ -298,8 +298,8 @@ func (g *Goic) process(res http.ResponseWriter, req *http.Request) {
298298
return
299299
}
300300

301-
qry, curl := req.URL.Query(), currentURL(req, false)
302-
restart := ` (<a href="` + curl + `">restart</a>)`
301+
qry, redir := req.URL.Query(), currentURL(req, false)
302+
restart := ` (<a href="` + redir + `">restart</a>)`
303303
if msg := qry.Get("error"); msg != "" {
304304
if desc := qry.Get("error_description"); desc != "" {
305305
msg += ": " + desc
@@ -324,7 +324,7 @@ func (g *Goic) process(res http.ResponseWriter, req *http.Request) {
324324
return
325325
}
326326

327-
tok, err := g.Authenticate(p, code, nonce, curl)
327+
tok, err := g.Authenticate(p, code, nonce, redir)
328328
if err != nil {
329329
g.errorHTML(res, err, restart, "authenticate")
330330
return

0 commit comments

Comments
 (0)