A Flight Sim Enthusiast's Notebook

中文 English 日本語 Français Deutsch Español 한국어 Русский 繁體中文

Comment Feature Restored

I just discovered a couple of days ago that the comment function on this site was broken. Users using Facebook could neither login nor leave comments, which is pretty incredible.

So I used the most basic debugging method to trace the logs bit by bit, and found that the response for the access token had changed.

The handling until now was like this:

    my $content = $response->decoded_content();
    return $app->errtrans("Invalid request.")
        unless $content =~ m/^access_token=(.*)/m;
        
    my $access_token = $1;
    $access_token =~ s/\s//g;
    $access_token =~ s/&.*//;

But recently it changed to a JSON format, so I commented out all the above code,

require JSON;
my $access_token = JSON::from_json($content)->{access_token};

and changing it to this fixed it.

Everyone is welcome to come and test it out