Forum Discussion
3 Replies
- rohithmadhavanEmployee
@rpatrick00 The
Account#connect()
method returns a Generic Type, and can be used to return an authentication String, a Session or Connection object etc. to the Snap code. An example can be found in the Account Configuration section of our Developer Documentation.For a
ValidateableAccount
, which simply extendsAccount
, theconnect()
method is called when the “Validate” button in the Account Settings UI is clicked. Your observation is correct that the return value isn’t used for Account validation, what matters is whether or not theconnect()
method returns successfully. The validation is considered successful if a value was returned, and validation fails if the call throws an Exception. You can find more information in the Validating Accounts section. - robinFormer Employee
@rpatrick00 The
T Account<T>.connect()
method supports Java Generics - you can make it return whatever type you choose (not just a String).If it is a String, it can be used to get a reference to a token value for example and be used in every request. It could also be a complex object holding a variety of information to be used however you wish, including outputting it in a Document.
- rpatrick00Contributor
In my case, “connect” doesn’t actually have any semantic meaning for my custom snaps (since they are sending custom SOAP messages to our legacy system) so I am using connect() to validate the connectivity and credential information used to make a SOAP call (by making a SOAP call). Somehow, I got the idea that I could influence the message that pops up in the UI using the message returned by the connect() method. Clearly, that idea was wrong…