2012-03-03 41 views
0

如何向我的authRequest添加範圍使用DotNetOpenAuth將範圍添加到OAuth 1.0授權請求

public void PrepareAuthorizationRequest(Uri authCallbakUrl) 
{ 
    var consumer = new WebConsumer(GoogleConsumerConsts.ServiceDescription, mConsumerTokenManager); 

    // request access 
    consumer.Channel.Send(consumer.PrepareRequestUserAuthorization(authCallbakUrl, null, null)); 

    throw new NoRedirectToAuthPageException(); 
} 

回答

1

作用域不是OAuth 1.0中定義的概念,您在本示例中使用了該範圍。要定義請求訪問的範圍,您應該閱讀您正在使用的服務提供商的文檔,幷包含所需的附加參數。假設服務提供商希望您包含scope參數,則應將其與第二個參數一起傳遞,如下所示:

var requestParameters = new Dictionary<string, string> { 
    { "scope", "http://some/scope" }, 
}; 
consumer.Channel.Send(consumer.PrepareRequestUserAuthorization(authCallbackUrl, requestParameters, null)); 
相關問題