Search code examples
botframeworkamazon-cognitoazure-bot-service

Cognito authorize endpoint in OAuth2 identity provider


been trying to figure this out forever, and I don't think it's supposed to be that complex...

I have an AzureAD setup with an OAuth2 Connection that I want to point to Cognito so that I can authenticate users in the User Pool, get a token back and call AppSync APIs, etc. Important note here, I cannot use Amplify in the current situation.

I have configured my App Client as follows:

enter image description here

The ngrok URLs are because I'm working on a cloud based app that needs tunneling. I have multiple URLs in there in the hope that I'd get one that works, to no avail.

To configure the OAuth2 Connection in Azure, I'm asked for 3 URLs,

authorize, token and refresh.
Here are the values I put into these fields

enter image description here

When I initiate the auth process with this connection, I get the redirect_mismatch error. I have no idea why. When I open the HostedUI, it shows up just fine, but it points to login instead of authorize. The redirect_uri, however, is localhost:3000/ as seen at the end of the address bar.

enter image description here

Clearly, I'm missing something, but I have no idea what. Should there be additional parameters in the config of my URLs on Azure's side? Anyone ever connected the two in this way? The company insists on this flow, and I just can't wrap my head around it.

Any and all help apreciated, thank you.

NOTE: There is a possibility to configure a custom OAuth2 connection on the side of Azure with more parameters, should this be the way? I do not, however, know what to put in these extra fields.

enter image description here


Solution

  • In the case of a Bot authentication, as it is the case in my situation, in Callback URLs, add the following:

    https://token.botframework.com/.auth/web/redirect

    This allows to open the authentication window when authenticating your bot.