Skip to content

Commit

Permalink
fix #182. remove access_token when navigating page result
Browse files Browse the repository at this point in the history
  • Loading branch information
huandu committed May 5, 2022
1 parent 01c37fb commit 8516e6b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/huandu/facebook/v2

go 1.12
go 1.13
4 changes: 4 additions & 0 deletions paging_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ func (pr *PagingResult) navigate(url *string) (noMore bool, err error) {
params := Params{}
pr.session.prepareParams(params)

// Per #182, access_token is always useless.
// As we may need to keep other params, do a manual delete here.
delete(params, "access_token")

if len(params) == 0 {
pagingURL = *url
} else {
Expand Down
2 changes: 1 addition & 1 deletion params.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func isEmptyValue(v reflect.Value) bool {
//
// Encode may panic if Params contains values that cannot be marshalled to json string.
func (params Params) Encode(writer io.Writer) (mime string, err error) {
if params == nil || len(params) == 0 {
if len(params) == 0 {
mime = mimeFormURLEncoded
return
}
Expand Down

0 comments on commit 8516e6b

Please sign in to comment.