getModel('oauth2').init(strParamsVariable);
getModel() automatically calls the init() for you, so even though you're trying to call it a second time it's too late since the init() has required params and has already errored.
Your first option is to pass in the init args ad-hoc like so:
getInstance( name="myCFC", initArguments={} )
I don't recommend this approach though because then you must supply those arguments EVERY time you request the CFC plus you're mixing initialization details into a file that has no business worrying about it.
The ideal approach when working with a 3rd party lib with required init args is to map it in your config/WireBox.cfc
map( "alias" )
.to( "path.to.cfc" )
.asSingleton()
.initArg( name="argName", value="constant" )
.initArg( name="argName2", ref="anotherMappingName" )
.initArg( name="argName3", dsl="coldbox:setting:settingName" );
Now that you've told WireBox how to build this CFC, you can just request it with getInstance( "alias" )
Now, if you REALLY don't; want to do the mapping and you're ok fiddling around with the code in the 3rd CFC (not generally recommended) you can just add an "inject" annotation in the arguments for that CFC's init. WireBox will see these when it builds the CFC and provide the init args automatically because it's just that awesome.
thirdParty.cfc
component {
/**
* @arg1.inject mappingName
* @arg2.inject coldbox:setting:settingName
*/
function init( required arg1, required arg2 ) {}
}
Thanks!
--------- Original Message ---------