Trongate Docs
switch to dark modeswitch to dark mode
»
»
User Code Segment Authorization

User Code Segment Authorization

There may be times when you'd like to allow access to users whose Trongate User Code can be matched with a value that has been passed via the URL.  This is where User Code Segment Authorization would be appropriate.

Top Tip
Trongate User Codes are random 32 character strings that are stored on the 'trongate_users' database table, on the 'code' column.  Don't make the mistake of confusing Trongate User Codes with Trongate security tokens.  Trongate User Codes are not a part of the underlying token authorization system with Trongate.  In short, this means that it's safe to reveal Trongate User Codes anywhere you like without fear of the Trongate token security system being compromised.

The basic syntax for User Code Segment Authorization is:

"authorization": {
    "userCodeSegment": segmentNum
}

Just To Let You Know
In the code example above, 'segmentNum' should be replaced with an integer that represents the URL segment that you'd like to read the Trongate User Code from.

Below is an example of a 'Get' endpoint where access has been granted to users whose Trongate User Code matches the value presented in the fourth URL segment:

"Get": {
    "url_segments": "api/get/members",
    "request_type": "GET",
    "description": "Fetch rows from table",
    "enableParams": true,
    "authorization":{
         "userCodeSegment": 4
    }
}


HELP & SUPPORT

If you have a question or a comment relating to anything you've see here, please goto the Help Bar.

 
×