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.

What to do if provider requires redirectUrl to be `https`?

See original GitHub issue

I’m trying to use Wunderlist provider.

It requires my redirect url to be website url (it does not allow app schema to be there)

So what I tried to do was creating my api endpoint /api/return/oauth/wunderlist that simply redirects back to the app with the same parameters.

And I configured auth so

const result = await authorize({
        clientId: WUNDERLIST_CLIENT_ID,
        redirectUrl: `https://myapp.com/api/return/oauth/wunderlist`,
        scopes: [],
        serviceConfiguration: {
          authorizationEndpoint: `https://www.wunderlist.com/oauth/authorize`,
          tokenEndpoint: `https://myapp.com/api/oauth/wunderlist/`,
          // registrationEndpoint
        },
      });

My return node.js handler is simply

export const returnToAppHandler: RequestHandler = async (req, res) => {
  const route = req.params[""];
  const queryParams = req.query;

  const serializedQueryParams = serializeQueryParams(queryParams);

  const appTarget = `myapp://${route}?${serializedQueryParams}`;

  res.redirect(302, appTarget);
};

So when I start auth flow it seems to work, then it redirects to my return to app api, but then auth window closes and nothing happens (no error, no result)

It seems like auth is still waiting for the in-app url.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
pkecommented, Dec 11, 2020

running into the same problem when the only allowed redirectUrl is “https://app.example.com/retur” then the safari will try to navigate to this (non-existing) URL.

- (BOOL) application: (UIApplication *)application
             openURL: (NSURL *)url
             options: (NSDictionary<UIApplicationOpenURLOptionsKey, id> *) options
{
  return [self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:url];
  //return [RCTLinkingManager application:application openURL:url options:options];
}

- (BOOL) application: (UIApplication *) application
continueUserActivity: (nonnull NSUserActivity *)userActivity
  restorationHandler: (nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
  if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
    if (self.authorizationFlowManagerDelegate) {
      BOOL resumableAuth = [self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:userActivity.webpageURL];
      if (resumableAuth) {
        return YES;
      }
    }
  }
  return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
}

However, the webview stays open saying “Safari cannot open the page because the server cannot be found”

1reaction
irishdancommented, Jul 27, 2020

Did you ever figure out what the issue was? I have a similar issue with the cronofy API

Read more comments on GitHub >

github_iconTop Results From Across the Web

Force your site to redirect to HTTPS (SSL)
If you need to manually force the redirect to HTTPS using specialized rules, you must first disable the automatic redirect in your panel....
Read more >
Redirects with HTTPS - DNSimple Blog
UPDATE July 2019: As of July 2019, we offer HTTPS redirects. You can now use DNSimple and URL records to redirect via HTTPS....
Read more >
IIS Redirect HTTP to HTTPS - SSL Certificates - Namecheap
In the sites list of IIS, right-click on your site. Choose the Explore option: iisred6 · Explore will open the document root directory...
Read more >
How to Redirect Website from HTTP to HTTPS? - Geekflare
First, you need to ensure the hosting provider offer SSL and enabled for your site. Login to cPanel and go to the files...
Read more >
HTTP Redirects with DNS, and Why HTTPS Redirects are So
No, you cannot redirect HTTP to HTTPS at the DNS level. ... If you don't have access to your web server, you will...
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