MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.28k stars 21.47k forks source link

TypeError: Invalid value for redirectUrl.The URL must be valid and be https:// #13237

Closed xocolatl-aficionado closed 6 years ago

xocolatl-aficionado commented 6 years ago

I ran through the whole tutorial whose return URL is returnURL: 'http://localhost:3000/auth/openid/return' and even addedallowHttpForRedirectUrl: true to the config.js file. Still gives me the same error. Does not work with localhost.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

SaurabhSharma-MSFT commented 6 years ago

@xocolatl-aficionado Thanks for your feedback! We will investigate and update as appropriate.

MohitGargMSFT commented 6 years ago

@xocolatl-aficionado Try this and let me know if this works,

  1. Configure returnURL (in config.js) as http://localhost:3000/
  2. Configure ReplyURL (in portal) as http://localhost:3000/
  3. Add "allowHttpForRedirectUrl: true" to the config.js file

If this works, I will modify the content accordingly.

xocolatl-aficionado commented 6 years ago

I tried that too. Same error. Could you provide a sample of the config file that does work? also, are any changes needed in the app.js? @MohitGargMSFT

MohitGargMSFT commented 6 years ago

@xocolatl-aficionado I understand what you are referring here. I did follow steps and faced the same issue. However, I was able to resolve it by adding this line: redirectUrl: config.creds.redirectUrl, in Step3.3 in OIDCStrategy under app.js file.

passport.use(new OIDCStrategy({
    callbackURL: config.creds.returnURL,
    redirectUrl: config.creds.redirectUrl,
    realm: config.creds.realm,
    clientID: config.creds.clientID,
    clientSecret: config.creds.clientSecret,
    oidcIssuer: config.creds.issuer,
    identityMetadata: config.creds.identityMetadata,
    skipUserProfile: config.creds.skipUserProfile,
    responseType: config.creds.responseType,
    responseMode: config.creds.responseMode
},

After making above change, my sample works as expected. Please try at your end and let me know if that works for you as well.

xocolatl-aficionado commented 6 years ago

redirectUrl: config.creds.redirectUrl Is that the only line you're referring to? I already had that line. @MohitGargMSFT If you indeed did change something, could you update the code on the website accordingly? I could then conveniently clone it and try getting it to work out of the box with my ids.

MohitGargMSFT commented 6 years ago

@xocolatl-aficionado If you were following the document, this line is missing in Step3.3. I will work on adding this line in the document. The code in the sample which we clone from GITHub need to be modified by following the document. Yes I was able to make my solution run by just adding this line and I followed same steps as stated in document. Thanks.

MohitGargMSFT commented 6 years ago

@xocolatl-aficionado I made below modifications in my local solution -

Added redirectUrl: config.creds.returnURL, in new OIDCStrategy Added allowHttpForRedirectUrl: true, in new OIDCStrategy Modified Step1.8 , to add reply URL in Azure Portal to http://localhost:3000/

Once, I did above change the solution in my local. I am able to run solution and login but it gives me Cannot Post/

s1

I will assign this issue to content author to further investigate and make required changes in documented step.

CelesteDG commented 6 years ago

Please note that we've removed the existing topic and it's redirecting to this more updated info in GitHub: https://github.com/AzureADQuickStarts/WebApp-OpenIDConnect-NodeJS. This updated content should have the latest/correct info.

CelesteDG commented 6 years ago

@MarileeTurscak-MSFT @MohitGargMSFT @MicahMcKittrick-MSFT @SaurabhSharma-MSFT #please-close The out-of-date instructions have been replaced with one we have on GitHub. Thank you.

mazer-rakham commented 5 years ago

These instructions on the new one still do not work correctly.