@@ -71,21 +71,22 @@ type Authorization struct {
71
71
Client * Client `json:"-"`
72
72
User User `json:"-"`
73
73
74
- Code string `json:"-"`
75
- CreatedAt time.Time `json:"-"`
76
- AccessToken string `json:"access_token"`
77
- TokenType string `json:"token_type"`
78
- ExpiresIn time. Duration `json:"expires_in"`
79
- RefreshToken string `json:"refresh_token,omitempty"`
80
- Scope string `json:"scope "`
74
+ Code string `json:"-"`
75
+ CreatedAt time.Time `json:"-"`
76
+ AccessToken string `json:"access_token"`
77
+ TokenType string `json:"token_type"`
78
+ ExpiresIn int64 `json:"expires_in"`
79
+ RefreshToken string `json:"refresh_token,omitempty"`
80
+ Scope string `json:"- "`
81
81
}
82
82
83
83
func NewAuthorization (c * Client , u User , scope string , expiresIn time.Duration , refresh bool , code bool ) (* Authorization , error ) {
84
84
a := Authorization {
85
85
Client : c ,
86
86
User : u ,
87
87
CreatedAt : time .Now ().UTC (),
88
- ExpiresIn : expiresIn ,
88
+ ExpiresIn : int64 (expiresIn .Seconds ()),
89
+ TokenType : "bearer" ,
89
90
Scope : scope ,
90
91
}
91
92
@@ -132,7 +133,7 @@ func (a *Authorization) Refresh(scope string, expiresIn time.Duration) error {
132
133
}
133
134
134
135
a .CreatedAt = time .Now ().UTC ()
135
- a .ExpiresIn = expiresIn
136
+ a .ExpiresIn = int64 ( expiresIn . Seconds ())
136
137
a .Scope = strings .Join (finalScopes , " " )
137
138
138
139
if b , err := secureRandomBytes (64 ); err != nil {
0 commit comments