Skip to content

Commit

Permalink
protonmail: fix "invalid refresh token" errors
Browse files Browse the repository at this point in the history
The UID is now provided as a header field.

Closes: #81
  • Loading branch information
emersion committed Mar 7, 2020
1 parent 87dbf04 commit 4ede51e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions protonmail/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ func (c *Client) AuthTOTP(code string) (scope string, err error) {
}

type authRefreshReq struct {
UID string `json:"Uid"`
RefreshToken string

// Unused but required
Expand All @@ -180,7 +179,6 @@ type authRefreshReq struct {

func (c *Client) AuthRefresh(expiredAuth *Auth) (*Auth, error) {
reqData := &authRefreshReq{
UID: expiredAuth.UID,
RefreshToken: expiredAuth.RefreshToken,
ResponseType: "token",
GrantType: "refresh_token",
Expand All @@ -191,6 +189,7 @@ func (c *Client) AuthRefresh(expiredAuth *Auth) (*Auth, error) {
if err != nil {
return nil, err
}
req.Header.Set("X-Pm-Uid", expiredAuth.UID)

var respData authResp
if err := c.doJSON(req, &respData); err != nil {
Expand Down

0 comments on commit 4ede51e

Please sign in to comment.