question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Interactive Console OAuth2 Auth: 404 with self-hosted portal

See original GitHub issue

We are struggling to get the interactive console in the developer portal running for our OAuth2 secured APIs.

  • we configured an OAuth2 service in the API-Management instance
  • configured an API to use the OAuth2 service
  • have an self-hosted portal with a custom domain behind an Azure Application Gateway
  • deployed the self-hosted gateway to a storage account in the $web container as described in the Wiki

When we open the interactive console, we are redirected in a new window to the AAD to give our consent to use the APIs AAD application. After that we are getting redirected to something like:

https://<portal-hostname>/signin-oauth/implicit/callback#access_token=ey-<LONG_TOKEN>
&token_type=Bearer&expires_in=3599
&scope=<app-id>%2fUser.Read+<app-id>%2f.default
&state=071e290a-56ef-ba38-7335-428fa490bcbf
&session_state=9c11d1ac-52a4-4e35-9573-763fc02e05d9

But this page does not exist in our self-hosted portal. Instead a 404 page is getting displayed.

Do we need to register a special handling of the signin-oauth/implicit/callback route? Or is there an error in our publishing step? It was working with the managed portal.

Any advice would be appreciated!

**UPDATE **: I managed to get it working by manually creating file in the blob storage at $web/signin-oauth/implicit/callback/index.html which looks like this:

<!DOCTYPE html>
<html>

<head>
    <title>Authentication</title>

    <script type="text/javascript">
        function closeWindow() {
            if (opener) {
                opener.postMessage({ uri: window.location.hash }, "*");
            }
            self.close();
        }
        closeWindow();
    </script>
</head>

<body>
    <h1>
        You have successfully authenticated.
    </h1>
    <button onclick="closeWindow()">Close</button>
</body>

</html>

Why is this page missing in our default self-hosted portal deployment?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
patstcommented, Mar 4, 2021

@azaslonov thanks for your reply and the clarification.

It would be great to be aware of this limitations/ circumstances when starting to self host the portal. With the current documentation I had the impression I am getting the same features when using the self-hosted portal.

For others having the same challenge: Now we use an Azure function to implement the auth code backend feature.

0reactions
mikebudzynskicommented, Mar 10, 2021

The backendUrl configuration option should also work with a custom domain, which is specified for the developer portal (so also its backend) in the API Management service.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I follow the instructions but got 404 at the last step #32 - GitHub
Describe the bug I followed all the instructions in section Using Docker, and got 404 error in hydra server Reproducing the bug Steps...
Read more >
Authorization failed in Self hosted developer portal, After Sign ...
This is working fine and token is generating in Managed-developer portal but when i do the same in self-hosted developer portal(Storage account ...
Read more >
Using OAuth 2.0 for Web Server Applications | Authorization
Using OAuth 2.0 for Web Server Applications ... Any application that calls Google APIs needs to enable those APIs in the API Console....
Read more >
Custom Auth 404 - Genesys Cloud Integrations
Hi All, I am trying to create a custom auth action for a custom ... "https://login.microsoftonline.com/${credentials.tenant}/oauth2/v2.0/ ...
Read more >
API Docs - GitLab Docs
You can use an OAuth2 token to authenticate with the API by passing it ... If not, it doesn't match an API endpoint...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found