Date Posted:
Product: TIBCO Spotfire®
Product: TIBCO Spotfire®
Problem:
How to obtain an OAuth access token using curl
Solution:
This article describes how to generate a client id/client secret and then how to use curl to get a temporary access token. It is unlikely that this is used in a production environment, but it hopefully gives the reader a better understanding of how an access token is obtained in the OpenID connect flow.
Use the register-api-client command-line command on the TIBCO Spotfire Server to generate an API user with a client id and a client secret.
C:\tibco\tss\10.1.0\tomcat\bin\config register-api-client --name myAPIuser -Sapi.rest.automation-services-job.execute Tool password: <provide tool password> Successfully registered a new API client with the display name 'myAPIuser': Client ID: 2e4e9b840e05e34a91c01cd2c54b303a.oauth-clients.spotfire.tibco.com Client secret: 776c3d9f461d2a49a548141f8bf8ae940f6836aa9d300681c7149bf268465df
Base64 encode the client_id:client_secret
You can e.g. using one of the many available online tools to Base64 encode it (simply google for "Base64 encode")
Example:
2e4e9b840e05e34a91c01cd2c54b303a.oauth-clients.spotfire.tibco.com:776c3d9f461d2a49a548141f8bf8ae940f6836aa9d300681c7149bf268465df
encodes as:
MmU0ZTliODQwZTA1ZTM0YTkxYzAxY2QyYzU0YjMwM2Eub2F1dGgtY2xpZW50cy5zcG90ZmlyZS50aWJjby5jb206Nzc2YzNkOWY0NjFkMmE0OWE1NDgxNDFmOGJmOGFlOTQwZjY4MzZhYTlkMzAwNjgxYzcxNDliZjI2ODQ2NWRmOQ==
This will be used in the curl request
Use curl to get a temporary OAuth access token from the TIBCO Spotfire Server
Note: curl is available in the command Prompt in Windows 10.
curl --header "Content-Type: application/x-www-form-urlencoded" --header "Authorization: Basic MmU0ZTliODQwZTA1ZTM0YTkxYzAxY2QyYzU0YjMwM2Eub2F1dGgtY2xpZW50cy5zcG90ZmlyZS50aWJjby5jb206Nzc2YzNkOWY0NjFkMmE0OWE1NDgxNDFmOGJmOGFlOTQwZjY4MzZhYTlkMzAwNjgxYzcxNDliZjI2ODQ2NWRmOQ==" --request POST --data "scope=api.rest.automation-services-job.execute&grant_type=client_credentials" http://yourserverhere.com/spotfire/oauth2/tokenTIBCO Spotfire Server 10.3.1 Installation and Administration manual: register-api-client
Keywords: soap, client id, client token, access token, openid connect, oauth, oauth2
Comments
0 comments
Article is closed for comments.