Elad Benda2
Elad Benda2

Reputation: 15482

Adding scopes to OAuth 1.0 authorization request with DotNetOpenAuth

How do I add scopes to my authRequest?

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();
}

Upvotes: 0

Views: 1269

Answers (1)

Andrew Arnott
Andrew Arnott

Reputation: 81801

Scope isn't a defined concept in OAuth 1.0, which you're using in this sample. To define the scope of requested access, you should read the documentation of the service provider you're using and include the required additional parameters. Assuming the service provider wants you to include a scope parameter, you should pass it in with the second parameter, like so:

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

Upvotes: 1

Related Questions