Skip to content

fix(oauth): derive token URL from configured server instead of hardcoded Teclib instance - #436

Closed
Yago-Otero wants to merge 4 commits into
glpi-project:mainfrom
Yago-Otero:feat_oauth_dynamic
Closed

fix(oauth): derive token URL from configured server instead of hardcoded Teclib instance#436
Yago-Otero wants to merge 4 commits into
glpi-project:mainfrom
Yago-Otero:feat_oauth_dynamic

Conversation

@Yago-Otero

@Yago-Otero Yago-Otero commented Aug 14, 2026

Copy link
Copy Markdown

Why this PR exists

Bug Report & Fix: Hardcoded token URL breaks OAuth authentication flow

Summary

Fix Verified: Once the token URL is changed from a hardcoded string to a dynamic endpoint, the OAuth 2.0 authentication flow works 100% successfully, allowing the agent to authenticate and push the inventory to GLPI without any errors.


Description & Root Cause

When testing OAuth 2.0 (Client Credentials) authentication on the Android Agent against our custom GLPI server, the credential exchange failed systematically.

Upon inspecting the codebase, we found that the app was ignoring the user's configured server URL because of a hardcoded developer endpoint left in the authentication flow:

  • Hardcoded endpoint causing the bug: https://stanislaskita.fr35.glpi-network.cloud/api.php/token

Because of this leftover URL, the agent was sending token requests to that external server instead of the user's configured instance.


Solution Applied & Results

We removed the hardcoded string and made the token URL dynamic by calling buildTokenURL().

Code Change Overview:

- String tokenUrl = "[https://stanislaskita.fr35.glpi-network.cloud/api.php/token](https://stanislaskita.fr35.glpi-network.cloud/api.php/token)";
+ String tokenUrl = buildTokenURL();

## Note

This branch is based on #420 (`feat_oauth`) and adds the fix on top, so the full diff contains both. If #420 is merged first, this PR will reduce to just the dynamic token URL change.

@stonebuzz

Copy link
Copy Markdown
Collaborator

Hi @Yago-Otero,

Thank you for your interest in my PR.

I’ve directly integrated the latest commit into the original PR, so there is no need to maintain a separate one.

We’re currently waiting for feedback from several testers before proceeding with the official release.

I suggest closing this PR and continuing the work and discussion in the original one.

Best regards,

@Yago-Otero

Copy link
Copy Markdown
Author

Hi @stonebuzz,

Thanks for integrating the fix into #420 so quickly.

Just to explain why I opened a separate PR: I couldn't push directly to your feat_oauth branch (I'm not a collaborator on the repo, and pushes to the official repository are restricted), so I forked the project and opened this PR with the change on top of your branch — it was the only way I could propose the fix.

Since the change is already in #420, I'll close this one. Happy to help with testing if you need extra feedback.

Best regards

@Yago-Otero Yago-Otero closed this Aug 14, 2026
@stonebuzz

Copy link
Copy Markdown
Collaborator

I'm always happy to receive feedback, so please don't hesitate to share your thoughts. Feel free to discuss it directly in the original PR so we can keep everything in one place. 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants