Dont get access token - api

I am using Oauth2 to get the access token, i can get the code but when I am using postman to get the access token i get an status 403.
this is the url that i am using:
https://www.linkedin.com/oauth/V2/accesstoken?grant_type=authorization_code&code=AQSSeTJlPER2UXROrlcxnZu1233VFqSGpnbb3LbySelnmayljjpasMtsCGJkPOD-tXGl4U_P-7q-OUxZl9cIvwo1niVT4v9UxfkBk-i0b4ZhY_2rKugw-ZXCPbQrf9qlfj9TX2eraJzfykUT78I7M6HRB0NMz5iqlnOmPvE5Yf6S486OTomn5xI-E2fk-FA&client_id=86k52xk4123dza&client_secret=kaouvpg1212iJyrw&redirect_uri=https%3A%2F%2F/www.test.co%2
Response:
<html lang="en">
<head>
<title>Unauthorized</title>
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAlFJREFUeNqUU8tOFEEUPVVdNV3dPe8xYRBnjGhmBgKjKzCIiQvBoIaNbly5Z+PSv3Aj7DSiP2B0rwkLGVdGgxITSCRIJGSMEQWZR3eVt5sEFBgTb/dN1yvnnHtPNTPG4PqdHgCMXnPRSZrpSuH8vUJu4DE4rYHDGAZDX62BZttHqTiIayM3gGiXQsgYLEvATaqxU+dy1U13YXapXptpNHY8iwn8KyIAzm1KBdtRZWErpI5lEWTXp5Z/vHpZ3/wyKKwYGGOdAYwR0EZwoezTYApBEIObyELl/aE1/83cp40Pt5mxqCKrE4Ck+mVWKKcI5tA8BLEhRBKJLjez6a7MLq7XZtp+yyOawwCBtkiBVZDKzRk4NN7NQBMYPHiZDFhXY+p9ff7F961vVcnl4R5I2ykJ5XFN7Ab7Gc61VoipNBKF+PDyztu5lfrSLT/wIwCxq0CAGtXHZTzqR2jtwQiXONma6hHpj9sLT7YaPxfTXuZdBGA02Wi7FS48YiTfj+i2NhqtdhP5RC8mh2/Op7y0v6eAcWVLFT8D7kWX5S9mepp+C450MV6aWL1cGnvkxbwHtLW2B9AOkLeUd9KEDuh9fl/7CEj7YH5g+3r/lWfF9In7tPz6T4IIwBJOr1SJyIGQMZQbsh5P9uBq5VJtqHh2mo49pdw5WFoEwKWqWHacaWOjQXWGcifKo6vj5RGS6zykI587XeUIQDqJSmAp+lE4qt19W5P9o8+Lma5DcjsC8JiT607lMVkdqQ0Vyh3lHhmh52tfNy78ajXv0rgYzv8nfwswANuk+7sD/Q0aAAAAAElFTkSuQmCC">
<style>
html, body, pre {
margin: 0;
padding: 0;
font-family: Monaco, 'Lucida Console', monospace;
background: #ECECEC;
}
h1 {
margin: 0;
background: #333;
padding: 20px 45px;
color: #fff;
text-shadow: 1px 1px 1px rgba(0,0,0,.3);
border-bottom: 1px solid #111;
font-size: 28px;
}

It looks like you are making a GET request which results in the parameters being sent as query-string parameters, according to step 3 here: https://developer.linkedin.com/docs/oauth2
They expect you to make a POST request which would cause the parameters to be sent via form parameters.
If you are using postman click the GET icon next to your URL and change it to POST.
====EDIT=====
You should remove your client_id and client_secret from the code sample. This is very insecure and can allow someone to make requests to LinkedIn using your account.

Related

Where does <style id="shopify-dynamic-checkout"> come from and how can I override it?

I am styling a Shopify site for the first and using the Minimalist theme as a base. I want to style the shopify-payment-button (But it now) button but have not been able to. I noticed looking that the page source code there is:
<style id="shopify-dynamic-checkout">
.shopify-payment-button__button--hidden {
visibility: hidden;
}
.shopify-payment-button__button {
border-radius: 4px;
border: none;
box-shadow: 0 0 0 0 transparent;
color: white;
cursor: pointer;
display: block;
font-size: 1em;
font-weight: 500;
line-height: 1;
text-align: center;
width: 100%;
transition: background 0.2s ease-in-out;
}
//etc, etc
being injected into the <head> which is overriding my styles. I can't find where this comes from to remove it. Would anyone know how?
Shopify injects styles and js for some elements on site inside {{ content_for_header }}, which you will find in theme.liquid file.
This tag contains default shopify files as well as files for some integrations and apps. For example if you install facebook pixel through shopify, the code for it will go to {{ content_for_header }}
It is not possible to control what goes to this tag directly. If you just need to change styling then I recommend to just overwrite styles, in worst case if you need to, use"!important" tag in css

How to check or ensure that client side cached images are rendered on android app on subsequent requests?

Our server returns ads to the publisher's app (android/iOS apps). Let's consider this case where the returned ad is an HTML with img tags containing remote images (resources stored in third party servers of ad networks). Something like this -
<!DO CTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>Untitled Document</title>
<style> #ad{ margin: 0px auto 0 auto; width: 308px; padding: 5px; height: 38px; border: 1px solid #ddd; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; background-color:#fff; text-align:left; } #ad h3{ padding: 0; margin: 0; color:#0067FF; font-weight: normal; font-size: 12px; } #ad a { color:#009C00; font-size: 10px; text-decoration:none; margin: 0; padding: 0; } #ad p.description { margin: 0; padding: 0; font-size: 8px; margin-bottom: 10px; } .ad_label{ margin: 0 auto 0 auto; text-align: center; color: #a09f9f; font-size: 12px; padding: 3px 0 0 0; } </style>
</head>
<body>
<div id="ad">
<h3>Junk-A-Car</h3>
yp.com/reviews
<p class="description">Find Local Automobile Salvage Need Help? Click Here!</p>
</div>
<img src="http://imp.admarketplace.net/imp?id=7R7wxEzkiFdwxr3NJGbzfQbX4BkW4BkXfYbW1C\WfQ\W4p\W4pH+7RcdIG7+GmwqgClkfZldfQ8XfQ2Xfp2XfpbW4Z8nxnEZGmzYI=EYgCbnHF3QJre+GmwqgClrfpf+fCDW7ncQHmzdJR3KiF2zfQld4C2nimE+jmzYIczvIpkY4Zq+fp8Yfp2nxr7kgCbnxGEwxRwKj=EYJCdQHG7Z7nckxZkX1CbZfQxZ1pHnHncZIEzQx=fzfBaafpbnHF4kjFcTGm4WHZkX5QLWftInIFEqGr4wxRIwxQdw5GNuJtkkfBIdxr7KImEVGmwqgGTOxY8PfCDX5t7Q8Q\kfZ2T8n4V8Q\Y5t7q8Q\dfplT8R\O1QlXfQfrKBIWjF7KiF2zfCb+4Q2nHnwqI=EYGmwqgCby" width="1" height="1" />
</body>
</html>
<img src="http://54.204.70.10/fam/view.php?p=__pid=4e17aeb00411789d__sid=102175__bid=1259380__cb=e56d08f1c9__h=1431522124__acp=800660a03aab58e96ec93211c5fc5db6__s=f398b7b975fb896b27fed55d213f6687" alt="" width="1" height="1" />
Questions
Do the images resources get cached, by default, on client side and the same get rendered on subsequent ad requests? If not, can it be enforced from server side, by passing "necessary" headers?
I tried testing with fiddler, and always observed "200 Ok" status being displayed for same images.
How do I know when a cached image is loaded?
Updates
Updated ad response format - HTML format.
The server generatng the HTTP protocol response is responsible for sending cache control headers along with it indicating whether it is permitted to be cached and if so whether the server needs to be informed before each use.
This blog begginners guide is a good place to start for details. Then move on to the RFC 7234 caching specification itself

"flying-sphinx start" results in Faraday::Error::ParsingError (for internal server error response)

I am getting below error while reindex or restart the flying sphinix on heroku
Running `flying-sphinx start` attached to terminal... up, run.8515/app/.bundle/gems/ruby/1.8/gems/json-1.7.5/lib/json/common.rb:155:in `parse': 757: unexpected token at
'<!DOCTYPE html> (Faraday::Error::ParsingError)
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<style type="text/css">
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 25em;
padding: 0 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
}
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
</style>
</head>
<body>
<!-- This file lives in public/500.html -->
<div class="dialog">
<h1>We're sorry, but something went wrong.</h1>
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
</div>
</body>
I have restart the thinking sphnix using command heroku run flying-sphinx restart
It looks like you've got a search daemon already running. You need to kill it first with thinking sphinx and then retry your flying sphinx reindex or restart.
Here's an answer that will show you how: Thinking Sphinx after deployment - ThinkingSphinx::SphinxError (unknown local index 'user_core' in search request):

CSS code for a table in Squarespace?

I'm looking for CSS code on creating a solid colored table with an image and text wrap. This is to be used in Squarespace. Anyone know how I can get that?
<html>
<head>
<style type="text/css">
.mycss {
background-color: #997E6E;
border: 21px solid #997E6E;
color: #FFFFFF;
font-family: arial, helvetica, sans-serif;
font-size: 15px;
font-weight:normal;
letter-spacing: 1pt;
line-height:1;
word-spacing: 2pt;
text-align: left;
}
</style>
</head>
<body>
<p class="mycss">
As my teacher says, our bodies are the best technology we have! Through it, we can transform ourselves from being blocked and out of balance into being energetic, clear-minded and open-hearted.
</p>
</body>
</html>
If you're doing this outside of the developer platform...
I would put the class inside a div instead of p
<div class="mycss">
<p> As my teacher says, our bodies are the best technology we have! Through it, we can transform ourselves from being blocked and out of balance into being energetic, clear-minded and open-hearted.</p>
</div>
Your css looks fine for the border. If you want to float the image to the right inside this div, add
.mycss img {
float:right;
}

WCF Rest service POST method fails in Fiddler

I'm using WCF Restservice to authenticate user. I have a POST method and works fine using jquery but fails on Fiddler test. I get 415 Unsupported Media Type.
Here is my code
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "Login", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
public string Login(string userName, string password)
{
string valid;
// Log in user
int authenticatedId = AuthenticateManager.Authenticate(userName, password);
if (authenticatedId != -1)
{
valid = "Welcome " + userName + "!";
}
else
{
valid = "Login failed!";
}
return valid;
}
This is what I'm passing in Fiddler body
[{ "userName":"dusshyi",
"password":"subram1" }]
This is what fiddler generating
<HTML><HEAD><STYLE type="text/css">#content{ FONT-SIZE: 0.7em; PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px}</STYLE>
<TITLE>Service</TITLE></HEAD><BODY>
<DIV id="content">
<P class="heading1">Service</P>
<BR/>
<P class="intro">Endpoint not found.</P>
</DIV>
</BODY></HTML>
Please help!
Have you set the Content-Type of the request to application/json in Fiddler's Request body editor?
I had the same problem this morning...
What fixed it for me was to click on the "Composer" tab, then add the following to the "Request Headers" section:
Content-Type: application/x-www-form-urlencoded
Without this line, I noted that the log showed it was attempting to call my REST Service with a Content-Type of "text/html", and the Service wouldn't get called.
This would even happen if I added the line:
Content-Type: application/json
However, after adding the line "Content-Type: application/x-www-form-urlencoded", Fiddler would now call the service with a Content Type of "application/json", and the web service was called correctly. Strange...
I've created a complete walkthough of creating a JSON WCF Web Service, and testing it with Fiddler, on the following page:
http://mikesknowledgebase.com/pages/Services/WebServices-Page1.htm
Fiddler Web Debugger:Composer section; settings
Parsed
POST,../Service.svc/Login,HTTP/1.1
Request Header:
User-Agent: Fiddler
Content-Type: application/json;charset=UTF-8
Host: localhost:15021
Content-Length: 43
Request Body:
{"username":"ABC","password":"pwd"}
and then execute