How To: Fetch profile information using hammock with linkedin oauth - c#

How do I get profile information of the authorized user, using Hammock https://github.com/danielcrenna/hammock
This is the call to get the profile default profile information https://api.linkedin.com/v1/people/~
So far I've been unsuccessful, sample code would be appreciated.

I found my answer here: http://mrsarker.wordpress.com/2011/08/20/linkedin-rest-api-in-asp-net-mvc/
The sample code helped me resolve my issue.

Related

Not able to get user info ( who commented ) of comments in a facebook page using graph api explorer

I am trying to get all the comments and users who commented those.
Using graph API explorer, for a particular page using page access token, I am able to get all the comments for a post and users who commented.
But using facebook App, I am only able to get comments and not the users who commented.
The user has Admin role on that page.
following are the steps I am following :
This returns list of pages and there page access token.
https://graph.facebook.com/me/accounts?access_token=XXXXXXXXXXXX
This returns the list of posts in that page
https://graph.facebook.com/{page-id}/posts?access_token=XXXXXXXXXXXX
This returns the list of comments
https://graph.facebook.com/{post-id}/comments?access_token=XXXXXXXXXXXX
In the last step I am suppose to get user details along with comment.
What am I missing ?

C# Web API 2 & Angular - Microsoft Account Authentication

I've asked the question below a couple weeks ago and I didn't get a working answer. Or maybe just not suitable for my case.
C# Microsoft Authentication Get logged user from controller
So I thought maybe I wasn't asking the right question. What i'm trying to do is create an app which has a C# Web API 2 backend and an Angular 2 frontend. Now, I want that my authentication be using people's Microsoft Account which means this will be an external authentication.
What's the best way of doing this? It would be very much appreciated if you can give a link on a blog or article that explain what I'm looking for. On my link above I've used msal.js and so far it was working fine for me until I had to get the logged user's details. It was possible from Angular's side but I want to do it in Web API so it is more secured.
Thanks in advance!
If you are using OpenId, you have claims that are returned when user is authorized. I am assuming you are using Azure B2C for authorization in which case you can select clams that will be returned as part of token.
For example, if you want to fetch user id:
var userId = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier")?.Value;
Email:
string userName = ClaimsPrincipal.Current.Claims.Where(x => x.Type == "emails").FirstOrDefault()?.Value;
It depends what claims your authorization has returned, easiest way would be to put breakpoint on
ClaimsPrincipal.Current
and inspect it, it should return list of claims.
From your code in the previous post, it looks like you need to read from the ClaimsPrincipal instead. ClaimsPrincipal is the implementation of IPrincipal when you use OAuthBearerTokens, so of course you can get the username from CurrentPrincipal.Current.Identity
From this documentation
https://msdn.microsoft.com/en-us/library/system.security.claims.claimsprincipal(v=vs.110).aspx
https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-devquickstarts-api-dotnet
public IEnumerable<Models.Task> Get()
{
var user = ClaimsPrincipal.Current;
...
}
i do with this example
https://github.com/Azure-Samples/active-directory-b2c-javascript-angular2.4-spa
and it work well

twitter get user profile data

I want to get the user profile data on connect to twitter. I managed to connect and get the access token and access token secret using Tweetsharp Lib. But trying to get the user profile throw an error.
So I want to use the Rest Api and just get the info my self.
I would like to see an example of how to pass the access token and or access token secret. Anybody can help me out please?
I am the developer of Tweetinvi which is a library similar to Tweetsharp but that is maintained and up to date.
You can get a user profile using the following code :
TwitterCredentials.SetCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret");
var user = User.GetUserFromScreenName("<username>");
I hope this can help you with your code.
Cheers,
Linvi

How to Authorize the service object for a specific user

In google docs api Developer's guide at many places it says
// TODO: Authorize the service object for a specific user
Can any one please tell how to do that exactly..
especailly in my case where for authentication I'm sending a POST request to https://www.google.com/accounts/ClientLogin and then parsing Authentication token.
You can use the following code to have the library perform ClientLogin for you:
service.setUserCredentials(username, password);
For more details, check https://developers.google.com/google-apps/documents-list/#authorizing_requests_with_clientlogin

How to get user details from OpenID server?

I'm wanting to save some OpenId fields to a localdatabase table, such as
•Full Name
•openid url
•passworg
how to get those attributes from openid server?
please send me some example code in asp.net, c#...
Assuming you'll be using DotNetOpenAuth, see these pages:
Simple Registration
AXFetchAsSregTransform
And know that for some providers like Google, the only way to get email address is to mark it as Required when you formulate the request.

Categories