Unable to retrieve access- and refresh-token - access-token

Every time I try to retrieve the tokens via
curl -L -X POST 'https://www.googleapis.com/oauth2/v4/token?
client_id=oauth2-client-id&
client_secret=oauth2-client-secret&
code=authorization-code&
grant_type=authorization_code&
redirect_uri=https://www.google.com'
(using my own client_id, secret and authorizationcode) I get an error instead of the two tokens. I restarted 5 or 6 times by deleting everything and create a new project but keep getting the same error :
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 411 (Length Required)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}#media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}#media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}#media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>411.</b> <ins>ThatΓÇÖs an error.</ins>
<p>POST requests require a <code>Content-length</code> header. <ins>ThatΓÇÖs all we know.</ins>
Who can help ? Thank you

You will need to POST the parameters instead of sending them as query parameters, so use something like:
curl -L -d 'client_id=oauth2-client-id' -d 'client_secret=oauth2-client-secret' -d 'code=authorization-code' -d 'grant_type=authorization_code' -d 'redirect_uri=https://www.google.com' https://www.googleapis.com/oauth2/v4/token
in such a form cURL will also add the required Content-Length request header automatically.

Related

SonarQube quality gate status fetching issue

I am trying to get the status of SonarQube quality gate status using below query
curl.exe -u "78c2b8628934a6cdc8ae80f5acadaaaafdfsa96" : "https://sonarurl/api/qualitygates/project_status?projectKey=MarUiSonarQube3"
then system prompted for password, after that I got below error:
Did I miss something?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>IIS Windows</title>
<style type="text/css">
<!--
body {
color:#000000;
background-color:#0072C6;
margin:0;
}
#container {
margin-left:auto;
margin-right:auto;
text-align:center;
}
a img {
border:none;
}
-->
</style>
</head>
<body>
<div id="container">
<img src="iisstart.png" alt="IIS" width="960" height="600" />
</div>
</body>
</html>
The url you specified is the following:
curl.exe -u "78c2b8628934a6cdc8ae80f5acadaaaafdfsa96" : "https://sonarurl/api/qualitygates/project_status?projectKey=MarUiSonarQube3"
The way you've specified the token value looks slightly off. Try changing it to the following (moving the colon to right after the token):
curl.exe -u "78c2b8628934a6cdc8ae80f5acadaaaafdfsa96:" "https://sonarurl/api/qualitygates/project_status?projectKey=MarUiSonarQube3"

Cannot type slash or single quote in firefox add-on input field

I'm learning to develop a Firefox add-on. I've made a simple dev-tools tab with an input box. I'm finding that I can type every character into the input box with the exception of "/" or "'". A forward slash or single quote will not populate. Nothing appears in the input box when I type these characters.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
body{
margin:0;
}
.warpath-search{
width:100%;
background-color:#fcfcfc;
border:1px solid #f0f1f2;
padding:.3em;
}
.warpath-search label{
width:100px;
display:inline-block;
}
.warpath-search input{
width:400px;
}
</style>
</head>
<body>
<div class="warpath-search">
<label>Xpath:</label><input type="text" name="warpath-xpath" id="warpath-xpath" />
</div>
<script src="devtools-panel.js"></script>
</body>
</html>
devtools-panel.js:
input = document.getElementById("warpath-xpath");
input.addEventListener("keyup", () => {
console.log(input.value);
});
Gif:
If I load the plugin's HTML file directly in the browser I can enter the characters but when it is loaded as a plugin it's blocked.
Using Firefox: 70.0.1 (64-bit)
The problem seems to have something to do with a Firefox type-ahead feature. The following steps resolved the issue for me:
Open about:config in the browser
Click "I accept the risk"
Search for "accessibility.typeaheadfind.manual"
Change the value of this key from "true" to "false"

I try to make a webvr panorama, but my image seems to be wrong

I'm making a webvr demo ( www.huiswijn.com/webvr ) It uses a single image that i rendered out. The code works just fine f I point to the google demo image ( https://storage.googleapis.com/vrview/examples/coral.jpg ), but not with my own.
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Megaplex</title>
<script src="https://storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>
</head>
<body>
<div id='vrview'></div>
<script>
window.addEventListener('load', onVrViewLoad)
function onVrViewLoad() {
var vrView = new VRView.Player('#vrview', {
width: 300,
height: 300,
preview: 'http://huiswijn.com/webvr/images/slaapkamer_vr.jpg',
image: 'http://huiswijn.com/webvr/images/slaapkamer_vr.jpg',
is_stereo: true
});
}
</script>
</body>
</html>
Error message:
Render: Unable to load texture from "http://huiswijn.com/webvr/images/slaapkamer_vr.jpg"
You've got the reason in your console:
three.min.js:424 Mixed Content: The page at 'https://storage.googleapis.com/vrview/2.0/index.html?preview=http://huiswijn.com/webvr/images/slaapkamer_vr.jpg&image=http://huiswijn.com/webvr/images/slaapkamer_vr.jpg&is_stereo=true&' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://huiswijn.com/webvr/images/slaapkamer_vr.jpg'. This request has been blocked; the content must be served over HTTPS.
You have to host your image over HTTPS.

How to re-direct to another page once the page is loaded completely

I am using go-gin and have a re-direct
c.Redirect(http.StatusMovedPermanently, myurl1).
Can I add a timer and call another re-direct once the first one completes in the same handler?
c.Redirect(http.StatusMovedPermanently, myurl1)
// sleep for 5 seconds
c.Redirect(http.StatusMovedPermanently, myurl2)?
Can I pause a handler's execution for a few seconds?
Simply put inside your page:
<meta http-equiv="refresh" content="5; url=http://example.com/" />
Another solution with javascript:
<script type="text/javascript">
setTimeout("location.href = 'http://example.com/';",5000);
</script>
your html logout page with 3-d party logout page inside
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="5; url=https://localhost:8080/login" />
<title>Test Layout</title>
<style type="text/css">
body, html
{
margin: 0; padding: 0; height: 100%; overflow: hidden;
}
#content
{
position:absolute; left: 0; right: 0; bottom: 0; top: 0px;
}
</style>
</head>
<body>
<div id="content">
<iframe width="100%" height="100%" frameborder="0" src="http://example.com/" />
</div>
</body>
</html>
If you want to redirect once the page is loaded, you have to do that in javascript.
The base of HTTP protocol is 1 query, 1 answer: "Get me this page" -> "Here it is".
You can't answer once to a query, and one second later and say "Oh, now you have to display this other page" (that's how the protocol was defined).
Therefore, if you want to redirect to another page after a short break, you have to insert a javascript call at the end of your file: Once the first redirection is done, then JS will execute itself, and you can put something like "Wait 5 seconds then call for this second page".

Why doesn't wkhtmltopdf page-break-after have any effect?

I'm using wkhtmltopdf 0.10.0 rc2 for Mac
I have an html like this one :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="print.css" rel="stylesheet">
<style type="text/css" media="screen,print">
.break{
display: block;
clear: both;
page-break-after: always;
border :1px solid red
}
.page-breaker {
display: block;
page-break-after: always;
border :1px solid red
}
</style>
</head>
<body>
<div class="container break">
page 1
</div>
<div class="page-breaker"></div>
<div class="container">
page 2
</div>
</body>
</html>
I simply try :
wkhtmltopdf test.html test.pdf
But it didn't produce a page-break, I doing something wrong ?
Possibly unrelated as your pdf generated ok with an earlier version of wkhtmltopdf. Either way, I had similar issues with page breaks not being applied correctly. My problem was parent elements of the page-breaked element having an overflow other than visible.
This fixed my issue:
* {
overflow: visible !important;
}
Of course, you can be more specific about the tags this applies to ;)
try using as follows
<div style="page-break-before:always;">
//your content
</div>
this should work.
I am usinf wkhtmltopdf 0.12.3.2
For me page-break-after works when a border is set, and when the breaker div is an immediate child of body.
.page-breaker {
clear: both;
display: block;
border :1px solid transparent;
page-break-after: always;
}
break-break-before does not work.
--print-media-type not needed.
I am using version wkhtmltopdf 0.12.0
For me, page breaks ONLY work with --print-media-type.
Without it, page break protection for images works, but not page-break-after or before.
I had to make a special css file for print media to get it work.
Setting the paper size to 'A3' or using the 'overflow: visible' didn't make any difference.
Also see WKHTMLTOPDF with pdfkit on Rails ignoring table page breaks
It is working fine after remove media print
Before:
#media print {
.page-break { height:0;page-break-after: always; margin:0; border-top:none;}
}
above code not working in new version.
Now
.page-break { height:0;page-break-after: always; margin:0; border-top:none;}
Update the wkhtmltopdf to version 0.12.5. Page break issue not occuring for me after updating.
Use --disable-smart-shrinking to avoid empty white space ( If you have any)
Use --zoom <value> to avoid page page (If entire page not showing)

Resources