Forum Discussion
Bot Framework Token Service - Error building redirect URI with query params
Hi,
I am currently using the Token Service with my bot for OAuth authentication with no problems so far, but there was a recent need to add a query parameter into my Authorization URL in the bot OAuth Connection Settings that seems to be breaking my application.
Checking some logs on my authentication service end I notice that the final redirect URI is being wrongly build.
This is my url in the Authorization URL field at the OAuth Connection Settings, with a fictional domain:
https://www.authservicehere.com/oauth2/v0/authorize?siwc=true
This is the redirect being generate by the Token Service:
https://https://www.authservicehere.com/oauth2/v0/authorize?siwc=true/oauth2/v0/authorize?redirect_uri=https://token.botframework.com/.auth/web/redirect&siwc=true?client_id=xxxxxx
Notice that it should be a & after the siwc param, the correct redirect URI would be:
https://https://www.authservicehere.com/oauth2/v0/authorize?siwc=true/oauth2/v0/authorize?redirect_uri=https://token.botframework.com/.auth/web/redirect&siwc=true&client_id=xxxxxx
It could also be without the siwc param, since its only used in the authorization url like so:
https://https://www.authservicehere.com/oauth2/v0/authorize?siwc=true/oauth2/v0/authorize?redirect_uri=https://token.botframework.com/.auth/web/redirect&client_id=xxxxxx
Is this an expected behavior? How can I deal with params in my authorization URL?
Thanks.
8 Replies
- ChetanSharma-msft
Microsoft
Hello PedroKlein - Could you please share your code snippets so that we can try it from our end?
- PedroKleinCopper Contributor
ChetanSharma-msft Sure, I am using a very similar login process as this https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/app-complete-auth/nodejs/bots/teamsBot.js using the Bot Framework https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-concept-authentication?view=azure-bot-service-4.0#about-the-bot-framework-token-service to manage my OAuth flow, my bot oauth config looks like this:
Without the query param siwc=true, the token service is working as expected.
- ChetanSharma-msft
Microsoft
Hello PedroKlein - We haven't implemented any sample which is passing parameters in Redirect URL.
https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples
We will check with engineering team once whether it is supported or not and let you know the updates.
Meanwhile, could you please also share the exact use case that you are trying to achieve via passing parameter?
- Sayali-MSFT
Microsoft
PedroKlein - Thanks for reporting your issue.
We will check this at our end and will get back to you.