-
Notifications
You must be signed in to change notification settings - Fork 29
IDT Incorrect Token URL in Documentation — www.idtdna.com returns 500, should use region-specific host (e.g. sg.idtdna.com) #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have mailed the IDT team, and will post updates here. |
IDT API team do not have a direct solution for dynamically setting the preferred host.
Checking for all sub-domains brute force, before erroring out should be a simple solution class IDTAccountAccessor:
"""Class that wraps access to the IDT API"""
_SUBDOMAINS = ['https://www.idtdna.com/', 'https://eu.idtdna.com/', 'https://sg.idtdna.com/']
_TOKEN_ENDPOINT = 'Identityserver/connect/token'
_SCORE_ENDPOINT = 'api/complexities/screengBlockSequences'
def __init__(self, username: str, password: str, client_id: str, client_secret: str):
....
self.base_url = None
self.token = self._get_idt_access_token()
def _get_idt_access_token(self) -> str:
....
for domain in IDTAccountAccessor._SUBDOMAINS:
result = post(f'{domain}{IDTAccountAccessor._TOKEN_ENDPOINT}', data, auth=auth, timeout=IDTAccountAccessor.SCORE_TIMEOUT)
if result.status_code == 200:
self.base_url = domain
return result.json()['access_token']
raise ValueError('Access token for IDT API could not be generated. Check your credentials.')
def get_sequence_scores(self, sequences: list[sbol3.Sequence]) -> list:
....
for idx, partition in enumerate(partitions_sequences):
resp = post(f'{self.base_url}{IDTAccountAccessor._SCORE_ENDPOINT}', json=partition,
timeout=IDTAccountAccessor.SCORE_TIMEOUT,
headers={'Authorization': 'Bearer {}'.format(self.token),
'Content-Type': 'application/json; charset=utf-8'})
response_list = resp.json()
|
Any thoughts? @Gonza10V @jakebeal @PrashantVaidyanathan |
While working with the IDT API, I encountered an issue with the OAuth2 token endpoint specified in the documentation.
Problem
The docs instruct developers to send token requests to:
However, this URL consistently returns an HTTP
500 Internal Server Error
for me.Working Solution
After some investigation, I found that using the region-specific subdomain works correctly. In my case:
This endpoint successfully returns an access token using the same credentials and request payload.
Screen.Recording.2025-05-05.at.23.57.12.mp4
The text was updated successfully, but these errors were encountered: