Callback URL in Skydrive API to localhost

2019-08-28 03:00发布

问题:

I am trying to implement SkyDrive API into my Asp.net mvc3 application.I tried to create app in Microsoft using this tutorial for implementing user authentication , but I am facing a problem in Callback Url, because Microsoft forces me to add a real domain and I want to use my localhost in order to develop it right now.

回答1:

Alternatively you could add a fake domain to your

  • /etc/hosts (Linux)
  • C:\Windows\System32\drivers\etc\hosts (windows)

file. Just add the following lines:

127.0.0.1   www.yourfakedomain.de

After adding that line you can choose in Microsoft OneDrive App-Center something like

http://www.yourfakedomain.de/blabla.php

as your redirect uri.

Since your operating system thinks that domain belongs to localhost you will be able to get your authentication code just normally at your local test domain ;-)



回答2:

How would SkyDrive call code on your local machine?

One way to do it is to first mock SkyDrive in your application -- that is, you don't call the real SkyDrive, just a service that you have running locally that acts as if it is SkyDrive. You can use that to develop and debug your application to some extent.

Then you can deploy your application to a test server on the Internet, so that SkyDrive can do the callback, and you can test it there and make the necessary modifications before you deploy to an actual production server.



回答3:

I find a solution for my problem, I used pageKite to solve my problem. pagekite gave me an alternative to my localhost by mapping my localhost to a real domain. so I added that domain to my app in Microsoft and its working.