Introducing the all-new TIBCO Community site!

For current users, please click "Sign In" to reset your password and access the enhanced features. If you're a first-time visitor, we extend a warm welcome—click "Sign Up" to become a part of the TIBCO Community!

If you're seeking alternative community sites, explore ibi, Jaspersoft, and Spotfire.

Jump to content

How to return an auth token in Fast Connector Framework (FCF)


Brian Thompson 2

Recommended Posts

Hi Brian,

Our documentation has samples for creating an authentication call in the ConnectionConfiguration() method: https://dev.scribesoft.com/en/sdk/fast_framewrk/simple_conn/sc_authentic...

 

Let us know if you think this is not helpful for your use-case. If that's the case, the Postman scripts and your ConnectionConfig() code will be helpful to shed some light on your exact use-case.

 

Best,

Nate

______

 

Help others find useful posts by selecting the best answer to your question. Click "Like" to highlight great replies.

Link to comment
Share on other sites

I selected "Basic" authentication when using the Fast Connector Framework Wizard. The call in Postman to get the token had the following properties:

 

Method = "POST"

URL=https://spm.ibmcloud.com/services/login

Header = (Key = Content-Type, Value = "application/json")

Body = {

"email":"XXXX",

"password":"ZZZZ"

}

 

This call returns a JSON formatted object containing the token needed to make additional calls to the application.

Link to comment
Share on other sites

Hi Brian,

You'll probably want to use the OAuth option so you can reuse the token.

 

You'll need to add properties in the ConnectionInfo class for your Email and Password:

public class YourConnectorConnectionInfo : JsonHttpConnectionInfoBase

{

// USE FOR OAUTH 2.0

public string email { get; set; }

 

[PasswordPropertyText(true)]

public string password { get; set; }

 

[PasswordPropertyText(true)]

public string token { get; set; }

}

Then you'll want to create classes for the input and output Json on the authentication call (here's an example how: https://www.youtube.com/watchv=5vwzB5Zm6AA).

 

Then you can add you Http POST to the ConnectionConfigure() method. Here's a lite example to get you going:

protected override Func ConnectionConfiguration()

{

//Used for OAuth

string LoginUrl = "https://spm.ibmcloud.com/services/login";

 

var myToken =

this.Connection.Configure("POST", LoginUrl)

.ToHeader("Content-Type", "application/json")

.ConnectionInfoToBody

.FromResponseToContext("Authorization", (rA => "Bearer " + rA.token))

.ConnectionInfoToBaseUrl(info => "https://spm.ibmcloud.com/....")

.End();

 

return myToken;

}

I hope this helps you get going.

 

Best,

Nate

______

 

Help others find useful posts by selecting the best answer to your question. Click "Like" to highlight great replies.

Link to comment
Share on other sites

For other readers, ConnectionInfoToBody can be used to pass the values collected in ConnectionInfo (i.e. the Email and Password a user provides in the Scribe Connection UI) to set values in an Input Class (also Email, Password) that will later be serialized as JSONwhen Scribe performs the Http Post needed to Authorize Scribe. The response from the server will be saved in an additional ConnectionInfo class (like "token") and can be used later.
Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...