puppetlabs / vault-plugin-secrets-oauthapp

OAuth 2.0 secrets plugin for HashiCorp Vault supporting a variety of grant types
Apache License 2.0
94 stars 10 forks source link

Add support for custom expiry time in refresh token flow, for apps th… #75

Closed RehmatGul0 closed 1 year ago

RehmatGul0 commented 1 year ago

Use Case For applications like Salesforce and Zendesk do not return the expires_in filed in the token response, for such applications access token was not refreshed. Added support to provide token_expiry field in the provider option and override token expiry with the value provided. This way, the user can define custom expiry time for apps where the expires_in field is absent.

Example

  1. vault write oauth_custom/servers/salesforcetest provider=custom client_id={{cliend_id}} client_secret={{client_secret}} provider_options=token_url=https://{{instanceid}}.my.salesforce.com/services/oauth2/token

  2. vault write oauth_custom/creds/salesforce server=salesforcetest grant_type=refresh_token refresh_token={{refresh_token}} provider_options=token_expiry=300

where token expiry is set to 300 seconds, 5 minutes.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

RehmatGul0 commented 1 year ago

Hi @impl please review and merge this Pull request so that we can use this plugin to support OAuth for apps which do not return the expires_in param in the access token response.