-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
- Added the possibility to get the email in the Twitter implementation #118
base: master
Are you sure you want to change the base?
Changes from all commits
bdabe39
430c007
073bfc4
abeca7d
ab0646c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
bin | ||
obj | ||
.idea | ||
*ReSharper* | ||
packages | ||
*.pyc | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ protected override Endpoint UserInfoServiceEndpoint | |
/// </summary> | ||
protected override void BeforeGetUserInfo(BeforeAfterRequestArgs args) | ||
{ | ||
args.Request.AddParameter("fields", "id,first_name,last_name,email,picture"); | ||
args.Request.AddParameter("fields", "id,first_name,last_name,email,picture.width(256).height(256)"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any reason the width and height is specified here. It seems we want three different image sizes. If this is due to an api change can you please attach a link to the info. |
||
} | ||
|
||
/// <summary> | ||
|
@@ -81,7 +81,7 @@ protected override void BeforeGetUserInfo(BeforeAfterRequestArgs args) | |
protected override UserInfo ParseUserInfo(string content) | ||
{ | ||
var response = JObject.Parse(content); | ||
const string avatarUriTemplate = "{0}?type={1}"; | ||
const string avatarUriTemplate = "{0}"; | ||
var avatarUri = response["picture"]["data"]["url"].Value<string>(); | ||
return new UserInfo | ||
{ | ||
|
@@ -91,9 +91,9 @@ protected override UserInfo ParseUserInfo(string content) | |
Email = response["email"].SafeGet(x => x.Value<string>()), | ||
AvatarUri = | ||
{ | ||
Small = !string.IsNullOrWhiteSpace(avatarUri) ? string.Format(avatarUriTemplate, avatarUri, "small") : string.Empty, | ||
Normal = !string.IsNullOrWhiteSpace(avatarUri) ? string.Format(avatarUriTemplate, avatarUri, "normal") : string.Empty, | ||
Large = !string.IsNullOrWhiteSpace(avatarUri) ? string.Format(avatarUriTemplate, avatarUri, "large") : string.Empty | ||
Small = !string.IsNullOrWhiteSpace(avatarUri) ? string.Format(avatarUriTemplate, avatarUri) : string.Empty, | ||
Normal = !string.IsNullOrWhiteSpace(avatarUri) ? string.Format(avatarUriTemplate, avatarUri) : string.Empty, | ||
Large = !string.IsNullOrWhiteSpace(avatarUri) ? string.Format(avatarUriTemplate, avatarUri) : string.Empty | ||
} | ||
}; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
using System; | ||
using Newtonsoft.Json.Linq; | ||
using OAuth2.Configuration; | ||
using OAuth2.Infrastructure; | ||
|
@@ -109,14 +110,14 @@ protected override UserInfo ParseUserInfo(string content) | |
return new UserInfo | ||
{ | ||
Id = response["id"].Value<string>(), | ||
Email = null, | ||
Email = response["email"] == null ? null : response["email"].Value<string>(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be better to call SafeGet to get the string value here so we don't blow up. |
||
FirstName = firstName, | ||
LastName = lastName, | ||
AvatarUri = | ||
{ | ||
Small = avatarUri.Replace("normal", "mini"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this due to an api change? If so can you please attach a link to the info? |
||
Normal = avatarUri, | ||
Large = avatarUri.Replace("normal", "bigger") | ||
Small = avatarUri, | ||
Normal = avatarUri.Replace("normal", "bigger"), | ||
Large = avatarUri.Replace("_normal", "") | ||
} | ||
}; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use
parameters
for this? I'm not sure we need to introduce a new field as all the other implementations are passing state when needed already.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think is the only form to pass parameters to the QueryUserInfo() method...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please confirm this as configuration is passed through to each oauth implementation. I know extra state parameters can be set on the initial request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's only for OAuth1 clients, Twitter specific, but maybe another OAuth1 client needs this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@titarenko do you have any more info on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you covert this to be a IDictionary<string,string>. It would be nice to not use any super specialized collections.