• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

wordpress one time log out by DELETE COOKIE

Scheduled Pinned Locked Moved General Discussion
1 Posts 1 Posters 978 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yaoyao1128
    wrote on last edited by
    #1

    Hi everyone,
    I use the sso plugin with wordpress and find it cannot log out at the same time. So I found that way. It might a little bit dangerous because it just delete cookie. Is there any other way to log out at same time?

    This is my way to logout

    Logout wordpress -> Delete Cookie of NodeBB -> return to nodebb homepage
    

    Step 1: create this php file under wordpress dir

    <?php
    require( dirname(__FILE__) . '/wp-load.php' );
    wp_logout();
    setcookie("express.sid", FALSE, time()-YEAR_IN_SECONDS, '', "~~FORUM_COOKIE_DOMAIN~~");
    
    header("Location: http://~~FORUM_COOKIE_DOMAIN~~/");
    exit;
    

    Step 2 : make NodeBB can access this file when logout
    When we logout form NodeBB, it send us to /logout and a string.
    So I use the nginx as proxy server to access php files. here is my config file of nginx

     location ~ .*\.php$ {
             rewrite ^/(.*) /$1 break;
            proxy_pass http://localhost:82;
            proxy_buffer_size  128k;
            proxy_buffers   32 32k;
            proxy_busy_buffers_size 128k;
    }
    location / {
            rewrite /logout  http://~~~FORUM_DOMAIN~~~/logoutbbs.php break;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
    
            proxy_pass http://io_nodes;
            proxy_redirect off;
    
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    
    
    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development