Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from onedox/refresh-expires-in
Browse files Browse the repository at this point in the history
Return expires_in for refreshAccessToken() and exchangeCodeForToken()
  • Loading branch information
hughns committed May 16, 2019
2 parents dc85f66 + 173dd00 commit 3faa9bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ deploy/releases/*.yaml

# .cache directories
**/.cache

package-lock.json
6 changes: 4 additions & 2 deletions src/v1/AuthAPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export class AuthAPIClient {
const parsedResponse: IAuthResponse = JSON.parse(response);
return {
access_token: parsedResponse.access_token,
refresh_token: parsedResponse.refresh_token
refresh_token: parsedResponse.refresh_token,
expires_in: parsedResponse.expires_in
};
} catch (error) {
throw new ApiError(error);
Expand Down Expand Up @@ -163,7 +164,8 @@ export class AuthAPIClient {
const parsedResponse: IAuthResponse = JSON.parse(response);
return {
access_token: parsedResponse.access_token,
refresh_token: parsedResponse.refresh_token
refresh_token: parsedResponse.refresh_token,
expires_in: parsedResponse.expires_in
};
} catch (error) {
throw new ApiError(error);
Expand Down
2 changes: 2 additions & 0 deletions src/v1/interfaces/auth/ITokenResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ export interface ITokenResponse {
access_token: string;
/** A long lived code use to obtain a new access_token when expired. It will be returned only if the scope offline_access was requested */
refresh_token: string;
/** access_token validity in seconds */
expires_in: number;
}

0 comments on commit 3faa9bb

Please sign in to comment.