You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How is authentication supposed to work now? I was on the 1.0.2 gem and this code was working:
namespace:authdodesc'Check if auth token is expired'taskcheck_token: :environmentdo@refresh_token=true@access_token_file=ENV['ACCESS_TOKEN_FILE']ifFile.exist?@access_token_filejson_web_token=YAML.load(File.read(@access_token_file))expires_at=json_web_token[:expires_at]ifexpires_at >= Time.now - 300puts'Loading JSON Web Token from file'@api_client=json_web_token[:access_token]@refresh_token=falseendendenddesc'Load Dotenv config and generate token'taskget_token: :check_tokendointegration_key=ENV['INTEGRATION_KEY']private_key=ENV['RSA_PRIVATE_KEY_FILE']api_username=ENV['API_USERNAME']api_endpoint=ENV['API_ENDPOINT']auth_server=ENV['AUTH_SERVER_URL']@account_id=ENV['ACCOUNT_ID']if@refresh_token == trueputs'Generating new access token'configuration=DocuSign_eSign::Configuration.newconfiguration.host=api_endpoint@api_client=DocuSign_eSign::ApiClient.newconfiguration@api_client.configure_jwt_authorization_flow(private_key,auth_server,integration_key,api_username,3600)json_web_token=Hash.autonewjson_web_token[:access_token]=@api_clientjson_web_token[:expires_at]=Time.now + 3600File.open(@access_token_file,'w'){ |file| file.write(json_web_token.to_yaml)}endend
But now it seems the configure_jwt_authorization_flow method has been replaced by request_jwt_user_token? But the method seems different and I don't understand what input it's expecting for scope. Can I get an example to work of off please.
The text was updated successfully, but these errors were encountered:
The eg-01-ruby-jwt should provide the example code but it hasn't been updated yet. I've filed DEVDOCS-1615
Re: use request_jwt_user_token? Yes, that's correct.
Meanwhile, here is my suggestion.
Notes:
Use the defaults for the scope and expires_in
It is better InfoSec to provide the private key as a string value, vs storing it on disk for the SDK to read. The string must include new line characters and the private key's header/trailer lines.
# Request JWT User Token
# @param [String] client_id DocuSign OAuth Client Id(AKA Integrator Key)
# @param [String] user_id DocuSign user Id to be impersonated
# @param [String] private_key_or_filename the RSA private key
# @param [Number] expires_in number of seconds remaining before the JWT assertion is considered as invalid -- Use default
# @param scopes The list of requested scopes. Client applications may be scoped to a limited set of system access. -- use default
# @return [OAuth::OAuthToken]
token = request_jwt_user_token(client_id, user_id, private_key_or_filename)
Hi,
How is authentication supposed to work now? I was on the 1.0.2 gem and this code was working:
But now it seems the configure_jwt_authorization_flow method has been replaced by request_jwt_user_token? But the method seems different and I don't understand what input it's expecting for scope. Can I get an example to work of off please.
The text was updated successfully, but these errors were encountered: