Software guru, Inc

Real World Solutions

The Guru's Blog

Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

Oct 6

Written by:
10/6/2013 5:11 PM  RssIcon

Embarcadero's new RAD Studio XE5 introduces unified, single source cross platform Development for Win32, Win64, Mac OS X, iOS and Android.  This is currently the best way to write cross platform applications over all these platforms.  Certainly Mono, can work to hit most of them; but deployment of such apps along with their performance is extremely complicated.  RAD Studio provides native level code on all of these platforms.  At some point, I hope to post more on this in detail.

In addition, they've implemented a new REST Client API supporting the REST Protocol and Open Authentication 1.0/1.1 and Open Authentication 2.0 this allows easy connection to most of the modern web API's.

Unfortunately there is a bug in the OAuth1 client that causes OAuth1 authentication to fail in the western hemisphere for Twitter, Tumblr and other 1.1 API's I've tried.

It appears that if your UTC offset is positive, Twitter works as intended (as does Tumblr) however if you are in a timezone west of Greenwich, you'll find yourself unauthorized by Twitter.

Twitter (and Tumblr) require the OAuth1 timestamp to be in GMT.  Thus one must convert the current date time to UTC before converting it to a UNIX timestamp.  This is an error in the supplied unit REST.Authenticator.Oath.pas.

To fix this problem, copy REST.Authenticator.Oath.pas from the /source/data/rest directory under your RS XE 5 program driectly to your local project directory.

Add it to your project and when you build, Delphi will take this version of the code rather than the default version.

Locate the function TOAuth1Authenticator.GenerateTimeStamp  and alter it to convert the local time pulled from Now() to UTC.

class function TOAuth1Authenticator.GenerateTimeStamp: string; begin

                result := IntToStr(DateTimeToUnix(TTimeZone.Local.ToUniversalTime(Now)));

end;


I'm not sure why any positive offset works, e.g. UTC+6:30 but it does.  So there are probably a couple layers to this, but this will make the REST Client with OAuth1 work properly with Twitter.


Update: 10/22/13


So I got all the way through on Tumblr to the point where I needed to request an Access_Token and Access_Token_Secret.  This worked fine on Twitter.  On Tumblr, things get a little more complicated.  Instead of seeing a PIN number, the callback response has the the request_token in the oauth_token field and a character string in ouath_verifier that you have to capture and use (just the oauth_verifier...the oauth_token is the request_token) as the VerifierPIN.


Now, when you do that, however, you keep getting authentication failed 401.


Took me a while to figure out what the problem is but...once again it's in the REST.Authenticator.OAuth unit.


When you don't yet have an access_token or access_token_secret, the OAuth workflow says to use request_token and request_token_secret in their place.


The Embarcadero OAuth code does this for access_token, but it does NOT do this for access_token_secret.


Therefore in the unit, on line 460 where you are generating the OAuth signature,  you have to adjust the code to check if access_token_secret is blank, and if so (and at this stage the answer is yes) and replace it with request_token_secret.


if AAuthenticator.AccessTokenSecret <>'' then
    LSigningKey := AAuthenticator.ConsumerSecrect + '&' + AAuthenticator.AccessTokenSecret // do not localize
  else     //JLL added to comply with what I see elsewhere for Tumblr.  And is consistent with using RequestToken for AccessToken before we have it.
     LSigningKey := AAuthenticator.ConsumerSecrect + '&' + AAuthenticator.RequestTokenSecret ;


This will make this stage work with Tumblr.


For some reason it wasn't a problem with Twitter...who knows, it should have been in a logically consistent world....

18 comment(s) so far...


Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

Dear Guru,
great patch.
Thanks a very lot for sharing.

Best regards

Roland

By Roland on   11/14/2013 3:30 PM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

The content that you are providing to solve out the problems related to the Delphi or Rad studio. You discussed it on some issues and give us superiorpaper and clearly information about this problem and their solutions. This information is really awesome and I need this. Thank you for sharing such a wonderful article.

By Sharon R. Kreitzer on   2/16/2017 12:16 AM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

Thank you for sharing this, here is a lot of information what is hard to find

By guidelines for literature review on   7/15/2020 6:04 AM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

If you are a student at your bachelor’s degree, an undergraduate student, or a student at your masters’ degree, you can contact us for dissertation methodology writing assistance.

By buy dissertation methodology help on   8/14/2020 10:52 PM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

Thank you for the post! That is so informative

By buy a dissertation conclusion writing service on   9/16/2020 3:40 AM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

If you do not have adequate time, we recommend you to forget about struggling with such an assignment face-to-face as our team is always ready to provide you with the qualified proquest dissertation abstracts help. We assure you that you will be impressed by our level of competency, as well as our responsible approach to work.

By KellyAdams on   10/18/2020 6:55 AM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

If you’re running out of time on your essay and just can’t make yourself start writing, check this site.

By Homeworkfor.me on   10/20/2020 2:58 AM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

Don't hesitate to cooperate with our team. You'll get perfect results for you academic papers and improve your writing skills definitely.

By writing a hypothesis of a dissertation on   11/17/2020 7:17 AM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

Many students are looking for unemployedprofessors.com review. In case you need it too, discover the hottest data about the service by clicking this link.

By unemployedprofessors.com reviews on   11/18/2020 12:54 PM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

I have a stupid problem with Twitter, with authentication issue. Thanks for taking the time out and sharing with us this useful idea. I like the way you present the information. Thanks again!

By guidelines for literature review on   12/7/2020 3:15 AM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

With your help I solve my problem. Thanks a lot.

By writing a literature review for a dissertation on   12/14/2020 6:48 AM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

Assignmentexpert doesn't provide clear pricing policy information. Is it expensive to order papers there? What is a standard Assignment Expert price for a 2-page essay?

By Assignment Expert on   2/21/2021 1:48 PM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

Red Bottom Shoes
Nike Air Max 95
Adidas Sneakers For Men
Asics
Nike Lebron 16
Louboutin shoes
Nike Basketball Shoes
Adidas Yeezys
Nike Factory Outlet
Jordan Retro
Ferragamo Belts
Huarache
Nike Shoes
Christian Louboutin Shoes
Nike Factory
Air Jordans
Nike Shoes
Nike Air Max
Yeezy
Lebron James Shoes
Pandora Necklace
Pandora Sale
Nike Factory Store
Jordan 11 Gamma Blue
Fjallraven Kanken
Nike Cortez
Nike Air Max 98 Gundam
Pandora Outlet
Pandora Sale
Nike Free Run
Pandora Jewelry
Yeezys Shoes
Nike Running Shoes For Women
Nike Clearance
Nike Shoes
Nike Air Zoom Pegasus 36
Nike Outlet Online
Christian Louboutin
Pandora Canada
Nike Sneakers For Men
Kyrie Irving Shoes
Christian Louboutin
Nike Store
Jordan Shoes For Kids
Lebron 17 Low
Nike Shoes 2019
Christian Louboutin Outlet
Yeezy Shoes
Nike Shoes For Women
Jordan Shoes
Golden Goose
Nike 720
Jordan Retro 13
Air Force 1
Christian Louboutin Sale
Nike Outlet Store
Nike Running Shoes
Lebron Shoes
Louboutin Outlet
Nike Outlet Store Online
Yeezy 500 Utility Black
Nike Air Force
Pandora Jewelry Official Site
Red Bottoms
Air Jordan Sneakers
Nike Air Max 270 Women's
Nike Factory
Kyrie Irving Shoes
Nike Outlet
Yeezy
Pandora Bracelet
Pandora Bracelets Charms
Nike Store Online
Air Max 98 Gundam
Pandora Ring
Lebron 16
Nike Zoom
Michael Jordan Shoes
Jordans Sneakers
Nike Hyperadap
Air Force Ones
Nike Outlet Store
Pandora Earrings
Nike Shox For Women
Stan Smith Adidas Sneakers
Sneakers Website
Moncler UK
Nike Shoes
Nike Presto
Pandora Jewelry
Nike Clearance
Nike Sneakers Outlet
Ferragamo Outlet
Nike Outlet Store
Nike Outlet Store Online Shopping
NMD R1
Louboutin
Nike Sneakers
Nike Free Run
Christian Louboutin Shoes
Cheap Nike Shoes
Nike Black Friday 2020
Nike Outlet Store
Pandora Charms
Nike Air Max 270
Louboutin Heels
Valentino Shoes
Pandora
Air Jordan Retro
Nike Factory
Nike Shoes
Air Force 1
Yeezy Boost
Nike Factory Outlet
Fjallraven Kanken
Pandora Charms
Nike Air Uptempo
Red Bottom Heels
Nike Shoes
Nike Air Max 270 Men
New Nike Shoes 2019
Pandora
Vans
Nike Shoes
Nike Outlet
Nike Outlet
Nike KD Shoes
Yeezy Sneakers
Adidas Ultra Boost
Nike Outlet Store
Basketball Shoes
Cheap Nike Shoes
Air Max 2019
Salvatore Ferragamo
Adidas Yeezys
Adidas Ultra Boost
Red Bottom Shoes For Women
Yeezy Boost 350
Christian Louboutin Shoes
NMD Adidas
Louboutin Outlet
Pandora Canada

By Joseph on   8/24/2021 7:05 AM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

Hello, I would like to thank you for sharing this interesting blog. Personally, I found it interesting and will definitely use some of them in life. Nevertheless, at this current moment, I use the letter writing service https://topwritingservice.com/letter-writing-service/ which I was being at university. It helped me so many times as well.

By Kyle Mitchel on   9/3/2021 1:58 PM
Gravatar

Re: Delphi/RAD Studio XE 5 OAuth1 Authentication issue with Twitter and Tumblr (Solution)

https://www.travisscott-jordan1.com/ Travis Scott Jordan 1
www.airsjordans.com/ Air Jordans
www.jordan-11s.com/ Jordan 11s
www.jordans-11.com/ Jordan 11
www.jordansshoes.org/ Jordans Shoes
www.moncler-outlets.com/ Moncler Outlet
www.off-white.us.org/ Off-White
www.yeezy-450.com/ Yeezy 450
www.yeezys500.com/ Yeezy 500
www.yeezyyeezy.com/ Yeezy
www.yeezys-700.com/ Yeezy 700
www.yeezys-supply.com/ Yeezy Supply
www.offwhiteshoess.com/ Off White Shoes
www.nflsjerseys.us.com/ NFL Jerseys
www.retro-jordan.com/ Retro Jordans
www.monclerjackets.us.com/ Moncler Jackets
www.nikeair-jordan.com/ Nike Air Jordan
www.jordanshoes.org/ Jordan Shoes
www.jordans-shoes.com/ Jordans Shoes
www.yeezy350-v2.com/ Yeezy 350 V2
www.adidasyeezys.com/ Adidas Yeezy
www.yeezyoutlet.us.com/ Yeezy
www.yeezy-700.us.com/ Yeezy 700
www.yeezyv2.us.com/ Yeezy
www.nike-outlets.com/ Nike Outlet
www.yeezy-shoes.us.com/ Yeezy Shoes
www.yeezyfoam-runner.com/ Yeezy Foam Runner
www.nikestoreoutlet.us.com/ Nike Outlet
www.nikeoutletfactory.us/ Nike Outlet
www.aj1.us.com/ AJ1
www.uncjordan1.us/ UNC Jordan 1
www.jordan-13.us/ Jordan 13
www.jordanaj1.com/ Jordan AJ 1
www.yeezy-supply.com/ Yeezy Supply
www.yeezy-zebra.com/ Yeezy Zebra
www.jordan-5.us Jordan 5
www.jordan1low.com/ Jordan 1 Low
www.air-jordans.us.org/ Air Jordans
www.pandoracharms.uk.com/ Pandora Charms
www.adidasuk.uk.com/ Adidas UK
www.nikestoreoutlet.us.com/ Nike Store
www.adidasyeezyofficialwebsite.com/ Adidas Yeezy Official Website
www.yeezy350.us.com/ Yeezy 350
www.jordan1.uk.com/ Jordan 1
www.nikesoutlet.us.com/ Nike Outlet
www.supplyyeezys.us/ YEEZY SUPPLY
www.pandoracharms.cc/ Pandora Charms
www.nikeshoes.cc/ Nike Shoes
www.nikeoutlet.uk.com/ Nike Outlet
www.pandoras-jewelry.com/ Pandora Jewelry
www.pandoraoutlet.org/ Pandora Outlet
www.jordanshoess.com/ Jordan Shoes
www.air-jordan4.com/ Air Jordan 4
www.charms-pandora.com/ Pandora Charms
www.pandorajewelryusa.us.com/ Pandora Jewelry
www.ringspandora.com/ Pandora Rings
www.bracelets-pandora.com/ Pandora Bracelets
www.yeezy-adidas.us.com/ Adidas Yeezy
www.yzy.us.com/ Yeezy
www.charmspandora.us.com/ Pandora Charms
www.nikeoutletstore.us.com/ Nike Outlet
www.adidas-yeezy.org/ Adidas Yeezy
www.airmax-720.com/ Air Max 720
www.nike-airmax270.com/ Nike Air Max 270
www.air-jordan11.com/ Air Jordan 11
www.air-force1.com/ Air Force 1
www.air-jordan1.com/ Air Jordan 1
www.nike-jordans.com/ Nike Jordans
www.jordan-1s.com/ Jordan 1s
www.pandorauk.uk.com/ Pandora UK
www.nikejordan1.com/ Nike Jordan 1
www.nikeairvapormaxflyknit3.us/ Nike Air VaporMax Flyknit 3
www.jordan-1.org/ Jordan 1
www.jordan11.org/ Jordan 11
www.yeezyslides.us.com/ Yeezy Slides
www.nikeairvapormax.us/ Nike Air VaporMax
www.nikevapormaxflyknit.com/ Nike Vapormax Flyknit
www.airjordan1-mid.com/ Air Jordan 1 Mid
www.yeezyadidas.de/ Adidas yeezy
www.yeezy-shoess.com/ Yeezy Shoes
www.adidasyeezy.me.uk/ Adidas Yeezy
www.yeezy350.de/ Yeezy 350
www.nikes.us.com/ Nike Shoes
www.nikeoutletstoreonlineshopping.us/ Nike Outlet
www.yeezystore.us.com/ Yeezy
www.nflshopofficialonlinestore.com/ NFL Shop Official Online Store
www.nikeuk.uk.com/ Nike UK
www.yeezy.uk.com/ Yeezy
www.yeezy350.uk.com/ Yeezy 350

By Nike Outlet on   9/11/2021 7:24 PM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment   Cancel 
You must be logged in and have permission to create or edit a blog.