manjeshpv / node-oauth2-server-implementation

Using oauth2-server: 3.0.0-b2 & Supports MongoDB, MySQL, PostgreSQL, MSSQL & SQLite
216 stars 103 forks source link

TOKEN lifetime #15

Open FeeFelipe opened 7 years ago

FeeFelipe commented 7 years ago

Hi,

I tried to set lifetime token, but the application keeps (60 * 60) from default settings

function getClient(clientId, clientSecret) {
  console.log("getClient",clientId, clientSecret)
  const options = {client_id: clientId};
  if (clientSecret) options.client_secret = clientSecret;

  return OAuthClient
    .findOne(options)
    .then(function (client) {
      if (!client) return new Error("client not found");
      var clientWithGrants = client
      clientWithGrants.grants = ['authorization_code', 'password', 'refresh_token', 'client_credentials']
      // Todo: need to create another table for redirect URIs
      clientWithGrants.redirectUris = [clientWithGrants.redirect_uri]
      delete clientWithGrants.redirect_uri
      clientWithGrants.refreshTokenLifetime = 9600
      clientWithGrants.accessTokenLifetime  = 10
      return clientWithGrants
    }).catch(function (err) {
      console.log("getClient - Err: ", err)
    });
}
manjeshpv commented 7 years ago

2 days ago oauth2-server beta 4 released. https://github.com/oauthjs/node-oauth2-server/releases/tag/v3.0.0-b4

I'm still not aware of the current implementation.

Refer documentation http://oauth2-server.readthedocs.io/en/latest/model/spec.html#getclient-clientid-clientsecret-callback

To discuss join https://oauthjs.slack.com

https://github.com/oauthjs/node-oauth2-server/issues/393