I am sharing my page "www.mysite.com/detail/?v=2442411" to linkedIn but I just get a "Oops" on linkedIn.
In code I have it like this:
string LinkedIn = $"https://www.linkedin.com/shareArticle?mini=true&url={mysiteurlvariable}?v={myidvariable}&title=ThisTitle"
It spits out this link:
https://www.linkedin.com/shareArticle/?mini=true&url=www.mysite.com/detail/?v=2442411&title=ThisTitle
When following the link as I say I just get a oops from LinkedIn.
Although when replacing the url with any other url also without a parameter its fine.
It seems like it does not like the ?v={myidvatiable} part
Anyone know of this issue or why this is an issue
You need to do URL-encoding with parameters you are feeding to another URL. And also, since you have posted your question, the LinkedIn Share URL parameters have changed. Source: Official Microsoft LinkedIn Share URL Documentation.
So, this is what you should want...
https://www.linkedin.com/sharing/share-offsite/?url={mysiteurlvariable}%3Fv%3D%7Bmyidvariable%7D%26title%3DThisTitle%22
Hope this helps!
Related
We are trying to authenticate internal users via Azure AD when they visit certain pages. Our servers are not on site, so we are looking for an API where we can just pass the username and password of the user and receive whether they are in our organization and which groups they are apart of. It was possible in framework. Does such a thing exist for .NET Core?
UPDATE:
Thanks for replying! It seems to be giving me the authorization code now and now I'm trying to use this to get a token to then use that access token to get the user's groups (please correct me if I'm going about this the wrong way). My problem is I keep getting a bad request error. I've gone over the parameters a bunch and can't find what I'm missing. Here is my current set up of the API URLS, am I missing something?
string postData = $"{{\"grant_type\":\"{grant_type}\",\"client_id\":\"{client_id}\",\"code\":\"{code}\",\"redirect_uri\":\"{redirect_uri}\",\"client_secret\":\"{client_secret}\"}}";
string redirectUrl = $"https://login.microsoftonline.com/{tenant_id}/oauth2/authorize?client_id={client_id}&response_type={response_type}&redirect_uri={redirect_uri}&response_mode={response_mode}&resource={client_id}";
string requestUriString = $"https://login.microsoftonline.com/{tenant_id}/oauth2/token";
UPDATE 2: I figured out what was wrong, I was passing the post data as a Json String when it needed to be x-www-form-urlencoded.
I'm not completely sure this will solve your problem but you might want to have a look at the following .NET Core sample (with MSAL.NET): https://github.com/Azure-Samples/active-directory-dotnetcore-console-up-v2
This is with the usual disclaimer that we really don't recommend anybody to use username/password. There are other much better possibilities. For the full picture, see https://aka.ms/msal-net-scenarios
I have a multilanguage site. Available languages are English and Dutch. I would like to be able to switch between those languages. So when a visitor clicks on the NL language it will point to www.website.com/languagecontroller/switchlanguage/language=nl?currenturl=http%3a%2f%2fwww.website.com%2f (currenturl parameter will be url encoded).
The redirect to the page and correct language will be done via the code below:
HttpContext.Response.Clear();
HttpContext.Response.StatusCode = 302;
HttpContext.Response.RedirectLocation = currentUrl;
HttpContext.Response.End();
The result (only in Chrome) I get is a blank page with in the address bar: www.website.com/languagecontroller/switchlanguage/language=nl?currenturl=www.website.com
The coding seems fine because Internet Explorer and Firefox are working fine, only Chrome is having issues. I've also tried Server.Transfer() but I experienced the same issue there.
I've been searching for the issue and it looks like it has to do with Chrome caching. But I'm not sure and was not able to find the/a solution. I don't see what might be wrong or how I can fix this so Chrome doesn't give me issues.
Does anyone have an idea?
Please refer http://en.wikipedia.org/wiki/HTTP_location
RFC 2616 requires an absolute URL in the HTTP LOCATION header, your URL is not well formed (from what I see above), add (http://) and convert it to well-formed absolute URL. Check, perhaps that would solve the problem.
The issue seems to be in the URL.
Hope this helps.
thanks
I just want to know if there is a naming standard on REDIRECT URIS for :
Twitter, LinkedIn, Microsoft, Facebook and Google when using OAuth 2.0?
Because, if I write my domain like that : http://domain.com/account/external-signin.aspx every external login stop working except Twitter and Facebook. The name account/external-signin.aspx is the real URL I'm working with and that I'm supposed to give to every external login.
So, Microsoft give this error:
We're unable to complete your request
Microsoft account is experiencing technical problems. Please try again later.
LinkedIn:
Invalid redirect_uri. This value must match a URL registered with the API Key.
And Google
400. That’s an error. Error: redirect_uri_mismatch
If I remove the page extension .aspx it seems to work although I deliberately write a wrong url like http://domain.com/sign-google, http://domain.com/sign-microsoft etc...
I'm working with MVC5 and C#.
I think I missed a few things ...
Thanks for your help
So finally, here is the correct answer:
It's not you that choose the redirect URL. You must write your domain.com/signin-{suppliername} in your app management.
Example:
Microsoft : https://domain.com/signin-microsoft
LinkedIn : https://domain.com/signin-linkedin
Google : https://domain.com/signin-google
Facebook and Twitter can work with your own redirect URL. Once successfully registered, the effect is immediate. Hope this can help somebody.
Karine
This error is denoting that you're having a miss match with the URL you're returning, and the return URL registered at the API Server. When you register your application, at the server, (for Google: https://code.google.com/apis/console) you have to make sure that the URLs being used would be matching.
After this, you will not get this error, I think on the server you've set this property to, http://domain.com/account/external-signin (without aspx; as you've said that this works without the extension but not with it). So try to change it on the server too.
For Linkedin append your url with "signin-linkedin".e.g. if your url is http://localhost:{portnumber}, make sure its is register in linked in as "http://localhost:{portnumber}/signin-linkedin" and this will do the trick.
Happy Codding :)
I'm trying simply to list a secured blog post from tumblr via .NET or C# there is a few non resolved posts and some examples how to post but not get.
Did anyone has some working code for it?
I've tried this:
http://www.codeproject.com/Tips/578418/Integrate-Tumblr-into-Csharp-NET-Website
http://dotnetopenauth.net/
Thanks
Why are you trying to get a secured blog post?
The documentation here is quite straightforward for getting a list of blogs for a certain user and all you need is the ApiKey so you don't need to OAuth at all. It is a GET request like so:
api.tumblr.com/v2/blog/{base-hostname}/posts[/type]?api_key={key}&[optional-params=]
You'll need to try this to see if your secured post comes back.
I am working on a social networking site. A user has an own profile-page.
A profile-page link example:
www.example.com/Profile.aspx?Username=Mike
Is there a way to remove the Profile.aspx from the link? (the Profile.aspx references to a Profile.cs)
And is there an other way to remove ?Username= ?
I just would like to have a simple and clear link like: www.example.com/Mike
Thanks in advance!
There are two possible method you could use:
If you are on .NET 4.0 or higher you can use routing (as already mentioned by #Arsen.
Another way would be to use URL rewriting. With URL rewriting you can tell IIS to process each incoming URL and map it to a different URL. More information on URL rewriting can be found here: http://www.iis.net/downloads/microsoft/url-rewrite