Ruby on rails server.
We are sending an email.
The content has a hyperlink, containing a URL which has a token in its query params.
The content also has the same URL in plain text.
Hyperlink
%p= link_to "Review", "#{#link}", target: "_blank"
Plain text
%p{ style: "word-wrap: break-word;" } #{#link}
When the destination address is #mailinator.com, the hyperlink URL will be altered and the security token from the URL params will not work anymore on the server.
This is the correct token from the plain text URL:
token=HM%2FTEkoKiTaBp0Ue%2BwPqjQ7Oxj4%2F1rWVuzgrxlUv2JEe6uGgdyuO41ENztyW%0A%2FpXewq1qY8MC
And this is the token from the URL modified by mailinator (the one you get after accessing the hyperlink):
token=HM/TEkoKiTaBp0Ue+wPqjQ7Oxj4/1rWVuzgrxlUv2JEe6uGgdyuO41ENztyW%0A/pXewq1qY8MCVa7fcmuu
QUESTIONS:
Is there anything on my side that I can do to fix this?
I checked and gmail does not alter the URL from the hyperlink.
OPINIONS:
I think this is a bug on the mailinator side.
From what I see, the mailinator guys are URL Decoding my token:
From the original:
HM%2FTE
They output:
HM/TE
Which is exactly the URL Decoding of the original value.
Related
I’m trying to get Dropbox token from call-back parameters but the parameters are always empty.
Here is my code:
sURL :=
https://www.dropbox.com/oauth2/authorize' +
'?response_type=token' +
'&client_id=' + MyAppID +
'&redirect_uri=http://127.0.0.1:8888/';
ShellExecute(0, 'OPEN', PChar(sURL), '', '', SW_SHOWNORMAL);
Next I have IdHTTPServer set to listen http://127.0.0.1:8888/ address.
On executing the browser with Dropbox log-in popup. When I made log-in the redirection is made and the “IdHTTPServerCommandGet” events is called. So far so good.
In the browser I can see the next URL:
http://127.0.0.1:8888/#access_token=123&token_type=bearer&uid=1234&account_id=dbid%1234
But in “IdHTTPServerCommandGet” events the parameters are always empty:
ARequestInfo.UnparsedParams; // Empty
ARequestInfo. QueryParams; // Empty
if ARequestInfo.Params.Count > 0 then // Empty
sToken := ARequestInfo.Params[0];
And here is my question. How can I get the whole URL with parameters from IdHTTPServer?
Look very closely at the redirect url you are seeing in your browser. All of the parameters you want to access are after a # character, not a ? character. That puts them in the "fragment" portion of the url rather than the "query" portion. A web browser does not include a url's "fragment" in an HTTP request to a web server. That is why the TIdHTTPRequestInfo properties are empty - the parameters are literally not being sent to your TIdHTTPServer. The redirected url needs to put the parameters in the url's "query" instead. That is Dropbox's responsibility to handle correctly on its end.
That being said, you don't actually need the TIdHTTPServer at all, if you use an embedded web browser directly in your app, such as Delphi's TWebBrowser. You can hook into the embedded browser to catch the redirect directly, and all of the data that is in the redirected url. This also allows you to use a custom url scheme for the redirect url, you don't have to use "http(s):" (see Redirect URLs for Native Apps).
I am trying to modify "Content-Disposition" value in "multipart/form-data" POST request with Fiddler that is automatically generated by webpage's javascript with attached image on file upload.
However, I cannot find a way to do it: when I try to simply replace the "Content-Disposition" Fiddler seems to convert entire content to string, replace the Content-Disposition string and convert back to bytes, which seems to break the attached image.
Several examples of code I have tried to use:
oSession.utilReplaceInRequest("string1","string2")
var strBody=oSession.GetRequestBodyAsString();
strBody=strBody.replace("string1","string2");
oSession.utilSetRequestBody(strBody);
While these successfully replace string1 with string2, the attached image is no longer valid.
What would be a way to do it?
I am trying to consume the google text to speech api here : https://cloud.google.com/speech-to-text/docs/async-recognize#speech-async-recognize-gcs-protocol
and it has this url format below
https://google-speech-api-base-urlspeech:longrunningrecognize
What is this URL format with colon(:)in the end?
When I try to hit this URL, it gives me an error specifically while running test case on it .e. Invalid URI. Invalid Port?
But the official google documentation says this is a valid url? How to use this?
This format of URL is called gRPC Transcoding syntax. Your first URL is invlaid , because it's in the first path segment of a relative-path reference.
https://google-speech-api-base-urlspeech:longrunningrecognize
This url is invalid for usage, whereas the one below, https://speech.googleapis.com/v1/speech:longrunningrecognize was running fine.
Try changing your URL to something like
https://google-speech-api-base-url/speech:longrunningrecognize. It will work.
I looked at the documentation page you referenced and was unable to see/find a URL that looked like:
https://google-speech-api-base-urlspeech:longrunningrecognize
However, what I did find was a URL of the form:
https://speech.googleapis.com/v1/speech:longrunningrecognize
which looks perfectly valid.
The documentation for this REST request can be found here:
https://cloud.google.com/speech-to-text/docs/reference/rest/v1/speech/longrunningrecognize
Could you have made an error in your reading and comprehension?
Apparently the colon (:) is legal in the path part of a URL:
Are colons allowed in URLs?
Trying to send HTML content in a SendGrid email header. I am getting drop email. The error is "REASON: Invalid SMTPAPI header"
This is my email template code
<%body%>
--|ALERT_MESSAGE|--
Here is the content I want to send (ROR string)
content = "<p>The system following info. [#{message}] <a href='#{url}'>#{url}</a></p>"
Here is my header code (self in this case is the header)
self.add_category("System Email")
self.add_filter('templates', 'enable', 1)
self.add_filter('templates', 'template_id', 'sdfs-f8fd6029')
self.add_substitution('--|MESSAGE|--', [content])
self.set_tos(SENDGRID_EMAILS)
Even if you are using a template, you need to specify some kind of body in the actual message, so that means you need to pass the html parameter i your request. This is an artifact due to transactional templates being added to the existing endpoint. A new mail sending endpoint is in the works that will not require text or html to be defined if a template is used.
I'm trying out http requests to download a pdf file from google docs using google document list API and OAuth 1.0. I'm not using any external api for oauth or google docs.
Following the documentation, I obtained download URL for the pdf which works fine when placed in a browser.
According to documentation I should send a request that looks like this:
GET https://doc-04-20-docs.googleusercontent.com/docs/secure/m7an0emtau/WJm12345/YzI2Y2ExYWVm?h=16655626&e=download&gd=true
However, the download URL has something funny going on with the paremeters, it looks like this:
https://doc-00-00-docs.googleusercontent.com/docs/securesc/5ud8e...tMzQ?h=15287211447292764666&\;e=download&\;gd=true
(in the url '&\;' is actually without '\' but I put it here in the post to avoid escaping it as '&').
So what is the case here; do I have 3 parameters h,e,gd or do I have one parameter h with value 15287211447292764666&ae=download&gd=true, or maybe I have the following 3 param-value pairs: h = 15287211447292764666, amp;e = download, amp;gd = true (which I think is the case and it seems like a bug)?
In order to form a proper http request I need to know exectly what are the parameters names and values, however the download URL I have is confusing. Moreover, if the params names are h,amp;e and amp;gd, is the request containing those params valid for obtaining file content (if not it seems like a bug).
I didn't have problems downloading and uploading documents (msword docs) and my scope for downloading a file is correct.
I experimented with different requests a lot. When I treat the 3 parameters (h,e,gd) separetaly I get Unauthorized 401. If I assume that I have only one parameter - h with value 15287211447292764666&ae=download&gd=true I get 500 Internal Server Error (google api states: 'An unexpected error has occurred in the API.','If the problem persists, please post in the forum.').
If I don't put any paremeters at all or I put 3 parameters -h,amp;e,amp;gd, I get 302 Found. I tried following the redirections sending more requests but I still couldn't get the actual pdf content. I also experimented in OAuth Playground and it seems it's not working as it's supposed to neither. Sending get request in OAuth with the download URL responds with 302 Found instead of responding with the PDF content.
What is going on here? How can I obtain the pdf content in a response? Please help.
I have experimented same issue with oAuth2 (error 401).
Solved by inserting the oAuth2 token in request header and not in URL.
I have replaced &access_token=<token> in the URL by setRequestHeader("Authorization", "Bearer <token>" )