print refresh token response

This commit is contained in:
Andre Medeiros 2021-07-15 18:47:11 -04:00
parent e46082949a
commit fb6f7751ae

View file

@ -13,10 +13,6 @@ import (
"github.com/valyala/fastjson" "github.com/valyala/fastjson"
) )
const (
tokenURL = "https://www.reddit.com/api/v1/access_token"
)
type Client struct { type Client struct {
id string id string
secret string secret string
@ -155,7 +151,7 @@ func (rac *AuthenticatedClient) RefreshTokens() (*RefreshTokenResponse, error) {
req := NewRequest( req := NewRequest(
WithTags([]string{"url:/api/v1/access_token"}), WithTags([]string{"url:/api/v1/access_token"}),
WithMethod("POST"), WithMethod("POST"),
WithURL(tokenURL), WithURL("https://www.reddit.com/api/v1/access_token"),
WithBody("grant_type", "refresh_token"), WithBody("grant_type", "refresh_token"),
WithBody("refresh_token", rac.refreshToken), WithBody("refresh_token", rac.refreshToken),
WithBasicAuth(rac.id, rac.secret), WithBasicAuth(rac.id, rac.secret),
@ -165,6 +161,7 @@ func (rac *AuthenticatedClient) RefreshTokens() (*RefreshTokenResponse, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
fmt.Println(rtr)
return rtr.(*RefreshTokenResponse), nil return rtr.(*RefreshTokenResponse), nil
} }