咱們知道,OAuth2.0使用AuthCode獲取AccessToken時,須要提供ResourceUrl做爲參數。這個ResourceUrl表示你用這個AccessToken只能讀取以ResourceUrl開頭的URL資源。好比ResourceUrl = https://test.sharepoint.com, 那麼得到的AccessToken只能夠訪問https://test.sharepoint.com/***。 若是你想用這個AccessToken訪問https://test-my.sharepoint.com, 對不起你會獲得一個401。資源
怎麼解決?get
方法就是用RefreshToken得到新的AccessToken,但ResourceUrl填寫爲新的地址。好比上述例子中,咱們在用RefreshToken獲取新的AccessToken時,ResourceUrl應該填寫:https://test-my.sharepoint.com。test
具體的介紹請參考MSDN:http://msdn.microsoft.com/en-us/library/azure/dn645538.aspx.方法