This repository was archived by the owner on May 1, 2024. It is now read-only.
Added flag for URL-escaping of scopes parameter #48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
URL-encoding the scope parameter of an OAuth request to Instagram (and possibly other services as well) causes a failure. If the scope parameter is “scope=basic+likes+comments+relationships”, it is URL-escaped by the Xamarin.Auth OAuth2Authenticator to "scope=basic%2Blikes%2Bcomments%2Brelationships”. The auth endpoint at Instagram does not like this and replies with {"code": 400, "error_type": "OAuthException", "error_message": "Invalid scope field(s): basic+likes+”comments+relationships}. A misleading message for sure, because as the error message rendered to the browser, it's not obvious that the parameter has been encoded. I imagine that other services work similarly and also barf if the scope param is URL-encoded. So, I have added a flag to the OAuth2Authenticator constructors to enable/disable the URL-encoding of the scope parameter. I added a flag instead of just removing the URL-encoding altogether because I am unsure of the behavior of other OAuth services when it comes to this matter. By default, the original behavior will remain, but provides the option to NOT encode the scope parameter.