Salesforce

Setting up OAuth 2.0 - Which cluster do I need for my request?

Article Information
 
Inhoud van het artikel
This article is part of the article serie Setting up OAuth 2.0 - Introduction

In this article we're going to validate the access token. By validating it you will receive an overview of useful information about the access token. In this overview you will find the cluster that you need for your requests.

To validate the access token send a GET request to this endpoint:
https://login.twinfield.com/auth/authentication/connect/accesstokenvalidation

The access token is connected to your client ID. Twinfield will only accept your GET request when you can proof to Twinfield that you are the owner of your client ID. You can prove this by sending along an authorization string. Please refer to this article: How to create an authorization string

Use the table below for the headers that you need to send along in your GET request.
 
Header___________Value
Content-Typeapplication/x-www-form-urlencoded
AuthorizationUse your authorization string. Please refer to this article: How to create an authorization string

Use the table below for the parameter that you need to send along in your GET request:
 
ParameterValue
tokenUse the access token that you want to validate.

If Twinfield accepted the access token and your authorization string, then you should receive a reply like this:

{
    "aud": "https://login.twinfield.com/auth/authentication/resources",
    "iss": "https://login.twinfield.com/auth/authentication",
    "nbf": "1638421526",
    "exp": "1638425126",
    "client_id": "yourclientid",
    "scope": [
        "openid",
        "offline_access",
        "twf.user",
        "twf.organisationUser",
        "twf.organisation"
    ],
    "sub": "eyJNZW1iZXJJZCI6######Ni00NmU2NjY2YTExNzgifQ==",
    "auth_time": "1638413243",
    "idp": "AAA",
    "amr": "external",
    "twf.organisationUserCode": "USERCODE_OF_ENDUSER",
    "twf.organisationId": "c5####10-####-####-####-46e####a1178",
    "twf.organisationCode": "ORGANISATIONCODE_OF_ENDUSER",
    "twf.clusterUrl": "https://api.accounting.twinfield.com"
}

At the bottom of the list you'll find twf.clusterUrl. This is the cluster to which you need to send your requests.

Good to know: The clusterUrl will be the same for all access tokens generated by the same refresh token. The clusterUrl doesn't change often (it might stay the same for years), but it can change at any moment if Twinfield finds this necessary. We recommend to look up the clusterUrl only once for a refresh token. Then you can keep using it until you receive an error. When you encounter an error, then you can look up the clusterUrl again. 

Good to know: The overview shows you the details of the end user. twf.organisationUserCode shows the username of the end user. twf.organisationCode shows the Twinfield organisation code of the user. Always mention this information when you contact Twinfield's support team. This way we can help you more efficiently.

Now that you know the cluster, go ahead and send your requests: Send a request
detail information
18-12-2021 8:47
Setting up OAuth 2.0 - Which cluster do I need for my request?
329
URL
Setting-up-OAuth-2-0-Which-endpoint-do-I-need-for-my-request

Powered by