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

Commit

Permalink
Merge pull request #78 from cubic-js/development
Browse files Browse the repository at this point in the history
fix: Temporarily remove auto-refresh in auth middleware.
  • Loading branch information
Kaptard authored Oct 8, 2018
2 parents a7113f9 + ac39160 commit bdc3174
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 28 deletions.
16 changes: 10 additions & 6 deletions middleware/native/http.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
const jwt = require('jsonwebtoken')
const Client = require('cubic-client')
// const Client = require('cubic-client')
const Cookies = require('cookies')

class ExpressMiddleware {
constructor (config) {
this.config = config
/**
this.authClient = new Client({
api_url: this.config.authUrl,
auth_url: this.config.authUrl,
user_key: this.config.userKey,
user_secret: this.config.userSecret
})
**/
}

decode (req, res, next) {
Expand Down Expand Up @@ -66,6 +68,7 @@ class ExpressMiddleware {

/* eslint camelcase: 'off' */
// Refresh access token if refresh token is provided
/**
if (err.name === 'TokenExpiredError' && req.refresh_token) {
const { access_token } = await this.authClient.post('/refresh', {
refresh_token: req.refresh_token
Expand All @@ -84,11 +87,12 @@ class ExpressMiddleware {
// No refresh token or already refreshed
else {
return res.status(401).json({
error: 'Invalid Token.',
reason: err
})
}
**/
return res.status(401).json({
error: 'Invalid Token.',
reason: err
})
// }
}
}

Expand Down
35 changes: 18 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
"ws": "^6.1.0"
},
"peerDependencies": {
"cubic-client": "^2.0.0"
"cubic-client": "^2.0.1"
},
"devDependencies": {
"cubic-api": "^2.0.0",
"cubic-auth": "^1.1.1",
"cubic-client": "^2.0.0",
"cubic-core": "^2.0.0",
"cubic-api": "^2.0.1",
"cubic-auth": "^2.0.0",
"cubic-client": "^2.0.1",
"cubic-core": "^2.0.1",
"cubic-loader": "^1.2.1",
"eslint": "^5.6.1",
"eslint-config-standard": "^12.0.0",
Expand Down

0 comments on commit bdc3174

Please sign in to comment.