Search code examples
phpfacebook-graph-apivanilla-forums

Vanilla Forums Facebook Authentication Error: UniqueID is required


Recently my instance of Vanilla Forums stoped authenticating users via Facebook. Instead, the error message "UniqueID is required" is shown in the authentication page.

Vanilla Forums error "UniqueID is required"


Solution

  • After some research I found this blog post, this github issue and this pull request.

    For now I fixed the function getAccessToken() replacing this:

        if (strpos(val('content_type', $Info, ''), '/javascript') !== false) {
            $Tokens = json_decode($Contents, true);
        } else {
            parse_str($Contents, $Tokens);
        }
    

    with this:

        if (strpos(val('content_type', $Info, ''), '/javascript') !== false) {
            $Tokens = json_decode($Contents, true);
        } else if (strpos(val('content_type', $Info, ''), '/json') !== false) {
            $Tokens = json_decode($Contents, true);
        } else {
            parse_str($Contents, $Tokens);
        }
    

    Since the Pull Request was merged a few days ago, the next release should fix this.