Remind before LinkedIn's sign-in expires, and stop posting once it has
LinkedIn tokens last 60 days and can't be renewed without signing in again. The expiry LinkedIn reports is now recorded (60 days from sign-in for older connections). The LinkedIn card says until when; from two weeks before, the Overview, the Inbox and the card remind you, with a Reconnect button. Once expired, LinkedIn counts as not connected, due posts come back to the Inbox saying why, and a 401 from LinkedIn reads "reconnect LinkedIn" instead of the raw error. Also fixes a leftover "Settings → Credentials" in a publish error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@ var httpClient = &http.Client{Timeout: 20 * time.Second}
|
||||
type Result struct {
|
||||
AccessToken string
|
||||
RefreshToken string
|
||||
ExpiresIn time.Duration // how long the access token lasts, if the provider said
|
||||
}
|
||||
|
||||
// Pending is a started flow, kept by the caller until the callback arrives.
|
||||
@@ -225,6 +226,7 @@ func tokenResponse(req *http.Request) (*Result, error) {
|
||||
var out struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
ExpiresIn int64 `json:"expires_in"`
|
||||
}
|
||||
if err := json.Unmarshal(raw, &out); err != nil {
|
||||
return nil, err
|
||||
@@ -232,7 +234,8 @@ func tokenResponse(req *http.Request) (*Result, error) {
|
||||
if out.AccessToken == "" {
|
||||
return nil, fmt.Errorf("no access_token in the token response")
|
||||
}
|
||||
return &Result{AccessToken: out.AccessToken, RefreshToken: out.RefreshToken}, nil
|
||||
return &Result{AccessToken: out.AccessToken, RefreshToken: out.RefreshToken,
|
||||
ExpiresIn: time.Duration(out.ExpiresIn) * time.Second}, nil
|
||||
}
|
||||
|
||||
func pkce() (verifier, challenge string, err error) {
|
||||
|
||||
Reference in New Issue
Block a user