From: Adam Shamblin Date: Mon, 12 Dec 2022 23:04:52 +0000 (-0700) Subject: Working account authentication, despite missing required field in masto docs. X-Git-Url: https://git.vexinglabs.com/?a=commitdiff_plain;h=3bd490b2a6cac43fa6c5929cdfe08477b0f746c4;p=dead-tooter.git Working account authentication, despite missing required field in masto docs. --- diff --git a/main.go b/main.go index ce3a486..680f31a 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "git.vexingworkshop.com/signal9/dead-tooter/pkg/mastodon" ) @@ -28,5 +30,10 @@ func main() { panic(err.Error()) } - account.VerifyCredentials(token) + err = account.VerifyCredentials(token) + if err != nil { + panic(err.Error()) + } + + fmt.Printf("%+v\n", token) } diff --git a/pkg/mastodon/account.go b/pkg/mastodon/account.go index 96da9d9..b651b1b 100644 --- a/pkg/mastodon/account.go +++ b/pkg/mastodon/account.go @@ -85,6 +85,7 @@ func (a *Account) Authorize(app Application) (code string) { func (a *Account) RequestToken(app Application, code string) (token Token, err error) { v := url.Values{} v.Set("client_id", app.ClientID) + v.Set("client_secret", app.ClientSecret) v.Set("code", code) v.Set("redirect_uri", app.RedirectURI) v.Set("grant_type", "authorization_code")