WordPress.org

Ready to get started?Download WordPress

Forums

Blogger Importer
Invalid Token (50 posts)

  1. greatwitenorth
    Member
    Posted 2 years ago #

    When I click the authorize button in the blogger importer I get taken to a Google page that says "Invalid Token".

    WordPress 3.4
    Blogger Import 0.5

    http://wordpress.org/extend/plugins/blogger-importer/

  2. Workshopshed
    Member
    Plugin Author

    Posted 2 years ago #

    Are you already logged into Google before pressing the button?
    What happens if you go to Blogger.com directly do you get a list of your blogs?

    Are you running from a test domain / local install? That's one combination I not sure is tested?

  3. Workshopshed
    Member
    Plugin Author

    Posted 2 years ago #

    I managed to get the same message by switching browsers and using an account I'd never used before. The interesting thing was that when I went back into the importer it had authorised and showed my blogs. Now I can't reproduce the problem.

    I was also thinking it might be some kind of timeout issue but I've tried waiting a couple of minutes between steps and that did not cause a problem.

  4. greatwitenorth
    Member
    Posted 2 years ago #

    Yes I was logged in to google before trying the importer (with the account I wanted to import from). Also I do see the blog at blogger.com in my account that I would like to import.

    I tried logging out of my account then tried to import from blogger again and still get the invalid token. When I go back to my WordPress install I do not see my blog listed, only the 'authorize' button.

    Nothing is showing up in the php error logs and google doesn't give me anything very descriptive except 'Invalid Token'.

    Here is the actual url I'm redirected to (I've remove the blog url but everything else is as is). Notice that there doesn't seem to be any values for token or token_secret:

    https://accounts.google.com/OAuthAuthorizeToken?oauth_token=&oauth_callback=myBlogURL%2Fwp-admin%2Findex.php%3Fimport%3Dblogger%26noheader%3Dtrue%26token%3D%26token_secret%3D

    Also shouldn't the '%3D%26' actually be '=&' ?

  5. greatwitenorth
    Member
    Posted 2 years ago #

    I see it's just the url encode of the oauth_callback parameter. Guess I'm out of ideas as to what the issue is.

  6. Workshopshed
    Member
    Plugin Author

    Posted 2 years ago #

    Is your blog locally hosted?
    Do you login to the Admin dashboard on HTTPS?

  7. greatwitenorth
    Member
    Posted 2 years ago #

    The blog is not locally hosted and I do not access the admin via https.

  8. Workshopshed
    Member
    Plugin Author

    Posted 2 years ago #

    I'm afraid the OAuth stuff is a bit beyond my skill set, I mostly looked at the processing of the feeds from XML. Perhaps Otto might be able to help?

  9. iampankaj
    Member
    Posted 2 years ago #

    I'm facing the same problem...

  10. Frogging101
    Member
    Posted 2 years ago #

    I've been having the same problem. It just won't work. The "Invalid Token" message pops up after I click Authorize and I just can't make it work. Please fix this ASAP as the issue prevents the plugin from being used.

  11. grrrlghost
    Member
    Posted 2 years ago #

    I have the same problem. Please, fix this!

  12. Workshopshed
    Member
    Plugin Author

    Posted 2 years ago #

    As you might appreciate it's not understood why you get this issue and if it is specific to your wordpress install or blogger account in some way.

    You can check if it's something about your account by visiting googles OAuth playground.

    http://googlecodesamples.com/oauth_playground/index.php

    1. click blogger
    2. skip this box
    3. click request token
    4. click authorise (this should take you to the google authorise screen)
    5. Upgrade token
    6. Paste "https://www.blogger.com/feeds/default/blogs" into box 6 and press execute

    If you get this far without errors then it's nothing specific to your account or blogger blogs that's causing the importer to error.

    Once you've checked with Google's OAuth Playground you should press the "start over" button to clear things down.

  13. Workshopshed
    Member
    Plugin Author

    Posted 2 years ago #

    Looking at the plugin authorisation code, there is another really simple check you can do.

    If you view the source code of the greetings page with the "Authorise" button on it. You should see a small form like the following:

    <form method="get" action="https://www.google.com/accounts/OAuthAuthorizeToken">
    <p class="submit" style="text-align:left;">
    <input class="button" type="submit" value="Authorize">
    <input type="hidden" value="4/VzMd0q8590WuynODngibGiSm5Yfh" name="oauth_token">
    <input type="hidden" value="http://mytestblog.com/wp-admin/index.php?import=blogger&noheader=true&token=4/VzMd0q8590WuynODngibGiSm5Yfh&token_secret=FJ5oONrlFqyDUx3JPGwl8ir1" name="oauth_callback">
    </p>
    </form>

    Confirm that there are values for the oauth_token and there is a value to the right of &token_secret.

  14. valerio.bulla
    Member
    Posted 2 years ago #

    Hi, I am experiencing the same issue, I've edited the importer code to show the error message (as written in this ticket), and I get a "name lookup timed out" error.
    I tried checking my account using OAuth playground and it all seems working.

    Interestingly, I've registered a free account at wordpress.com (I wanted to try and see if I had the same issue there), but it works flawlessly there.

  15. Workshopshed
    Member
    Plugin Author

    Posted 2 years ago #

    Velerio, nice to know that diagnostics function was of use. Googling that message, it's occurred for a few people in different places, specifically downloading of updates.

    This article seems to have a work around that should work in this case.

    http://fatlabmusic.com/blog/2009/08/12/how-to-fix-wp-http-error-name-lookup-timed-out/

    For another plugin I added the action 'wp_feed_options' to change the timeouts, we might be able to use the same technique here.

  16. valerio.bulla
    Member
    Posted 2 years ago #

    Works like a charm! It's importing!
    I really owe you one :)
    Thank you so much!
    I also hope this can be useful to other people having this same issue.

    So, do you think this problem could originate from crappy hosting? I've been trying a different hosting company because I had issues with my previous one (not related to this particular case), and I want to make sure whether it's the cause of the problem or not.

  17. Workshopshed
    Member
    Plugin Author

    Posted 2 years ago #

    It might make a difference which host you have but a DNS timeout could occur for many reasons which might not change when you switch.

  18. valerio.bulla
    Member
    Posted 2 years ago #

    I see, thank you again ;)

  19. InfernoZeus
    Member
    Posted 1 year ago #

    I'm having the same issue. I'm testing on a locally hosted blog, OAuth Playground testing that Workshopshed suggested worked perfectly, but when I inspect the form, the oauth_token field is blank, as is token and token secret in the value for oauth_callback.

    In my hosts file, I've set the host that this will eventually be deployed to as 127.0.0.1, so the environment is completely identical as far as WordPress is concerned.

    Any ideas why the oauth_token isn't being generated? Can I force it to happen somehow?

  20. smigielski
    Member
    Posted 1 year ago #

    You can try this fix:

    http://bloggertowp.org/solved-blogger-importers-authorization-failed-403-invalid-authsub-token-error/

    I have just import my blogger thanks to above plugin. After uploading wordpress ask you to update to newer version of this plugin but do not do this, because you will be back with buggy version again

  21. Workshopshed
    Member
    Plugin Author

    Posted 1 year ago #

    smigielski, I'm a little surprised that the 0.2 version you suggest using works currectly (unless you've made some enhancements?).
    A ticket has been raised on this. http://core.trac.wordpress.org/ticket/21163.

    InfernoZeus, the problem is possibly some kind of timeout. You could try adding the block of code suggested by Brent.

    http://fatlabmusic.com/blog/2009/08/12/how-to-fix-wp-http-error-name-lookup-timed-out/

    The code change in http://core.trac.wordpress.org/ticket/21163 will give you additional information as to the problem.

    Before you ask, yes there are plans afoot to merge these kinds of changes into the plugin. I'm still working on improving the blogger importer (in my spare time, as I have a day job), I'm mostly focused on getting it to handle images but it would be nice to deal with these other issues too so please keep adding any findings you get.

  22. smigielski
    Member
    Posted 1 year ago #

    I haven't made any changes in that plugin.

    I've already tried adding those code to print any additional debug message but it did't show anything, despite the fact that security code was still empty in oauth request.

    My import is hopefully done so thanks for a great plugin and your good job.

  23. InfernoZeus
    Member
    Posted 1 year ago #

    I've solved the problem I was having. First I swapped in the code in the ticket, which added in the various debug messages. This resulted in the following error message:

    There are no HTTP transports available which can complete the requested request.

    A quick Google reveals the issue as Curl not being enabled by default in XAMPP. I edited my php.ini, enabled Curl, and the importer worked perfectly.

    Perhaps adding an error message such as 'Curl is required for this importer to work. Please enable it and then try again.'

    Also, should I post this information on the ticket as well?

  24. Workshopshed
    Member
    Plugin Author

    Posted 1 year ago #

    I'd suggest that it's a case of updating the docs so that they mention pre-requisites, the importers should support any of the transports supported by WordPress.

    It's the server that's doing the import so it might be worth mentioning that too as if it's behind a firewall or similar then it might not be able to complete the import.

    Glad you got things fixed.

  25. greatwitenorth
    Member
    Posted 1 year ago #

    I can't believe I never thought of the firewall. I guess I was unaware that it was fetching the posts through curl (although it makes sense). I turned off our server's firewall and it worked perfectly!

  26. Workshopshed
    Member
    Plugin Author

    Posted 1 year ago #

    We definately need to update the FAQ then!!

  27. InfernoZeus
    Member
    Posted 1 year ago #

    I've been taking a look at the code to work out why it fails when curl isn't available on the server. According to WP docs, if it uses wp_remote_get, then it should be able to access the url with any available transports. I installed the Core Control plugin and it lists all three transports as available (curl, streams and fsockopen), however if I disable curl, the importer immediately fails again.

    Does anyone know if there's a reason that the WP API isn't falling back onto the other two options?

  28. Arkadiusz Rzadkowolski
    Member
    Posted 1 year ago #

    I had this error with version 0.5 and wordpress 3.0 (I had to use it). In my case invalid token was there because headers were wrongly seperated from body.

    var_dump($req_token); //  wp_remote_retrieve_body(wp_remote_get($req_req->to_url(), array('sslverify' => false)));

    output was like this:

    ontrol: no-cache
    
    Connection: Close
    
    oauth_token=4%2FWVWV7Y6tWnRCqW0Ze-noGjO4JXIJ&oauth_token_secret=4wrgRbezXLsjFXlAGiYXrK3w

    I had to change:

    1.

    parse_str($req_token, $tokens);

    to:

    $req_token = substr($req_token, strpos($req_token, 'oauth_token='));
    parse_str($req_token, $tokens);

    2.

    parse_str($after_access_request, $access_tokens);

    to:

    $after_access_request = substr($after_access_request, strpos($after_access_request, 'oauth_token='));
    parse_str($after_access_request, $access_tokens);

    3.

    $response = wp_remote_retrieve_body($data);

    to:

    $response = wp_remote_retrieve_body($data);
    $response = substr($response, strpos($response, '<?xml'));

    Everything works fine since then.

  29. phmag
    Member
    Posted 1 year ago #

    So in reading through this I'm still trying to determine if the problem has been solved or not as I'm getting the same error, and am clueless as what I need to do to fix it.

  30. Workshopshed
    Member
    Plugin Author

    Posted 1 year ago #

    Hi phmag,
    I've not had chance to review fliespl's code changes and how to ensure that these work both for 3.0 and 3.4.

    If you are on 3.0, either upgrade or try fliespl's code changes.

    If you are on 3.4 then you need to:

    Ensure that Curl is installed, it should work with other transports but as InfernoZeus reports there could be issues with that.
    Ensure your server can connect to Google (no firewalls etc)
    If you are still getting problems after that then the code change in http://core.trac.wordpress.org/ticket/21163 will give you additional information as to the problem.

    Unfortunately I don't have permissions to change the code as this is WordPress' plugin or I'd have put the message patch in place.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic