A second LinkedIn app (Community Management API) with its own sign-in on Settings → Social accounts: the pages the member may post for are listed and one chosen, new LinkedIn drafts default to the page or to you, and each draft can switch before it's published. Schema 25. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
771 B
Go
24 lines
771 B
Go
package oauth
|
|
|
|
import (
|
|
"net/url"
|
|
"testing"
|
|
)
|
|
|
|
func TestLinkedInStartScopes(t *testing.T) {
|
|
raw, p, err := LinkedInStartScopes("linkedin-page", "cid", "http://localhost:8470/auth/linkedin-page/callback", LinkedInPageScopes)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
u, _ := url.Parse(raw)
|
|
q := u.Query()
|
|
if q.Get("scope") != "w_organization_social r_organization_admin" || q.Get("client_id") != "cid" || q.Get("state") != p.State ||
|
|
p.Provider != "linkedin-page" || p.RedirectURI != "http://localhost:8470/auth/linkedin-page/callback" {
|
|
t.Errorf("%s %+v", raw, p)
|
|
}
|
|
raw, p, _ = LinkedInStart("cid", "http://x/cb")
|
|
if u, _ := url.Parse(raw); u.Query().Get("scope") != "w_member_social openid profile" || p.Provider != "linkedin" {
|
|
t.Errorf("member: %s", raw)
|
|
}
|
|
}
|