0

I am working on a tool which uses PHP, MySQL, and it accesses a user's ASANA profile. A user is authenticated using OAuth 2.0 with ASANA API.

The application is working fine, the only issue is the logout functionality. I am able to logout from my application, but I can't erase the cookies set by ASANA. (It's okay for personal computers, but in case of public computers it can create issues.)

How do I logout the user from ASANA while he/she logs out of my application? I tried other posts and saw some solutions for Google API and Facebook API where members recommended using API's logout links.

I couldn't find any such thing for ASANA. The direct logout link: https://app.asana.com/-/logout works fine, but then I am not able to redirect it to my application. Any suggestions would be a great help.

Code for current logout functionality:

<?PHP
include_once '../dbAPI/dbconnect.php';
session_start();    
mysqli_close($conn);
session_destroy();
header("Location: https://app.asana.com/-/logout")
?>

Thanks;

AKSH
  • 19
  • 1
  • 6

2 Answers2

0

There is no current functionality to make this process very smooth. This is mainly due to the fact that exactly how this would work in the many possible scenarios is not a straightforward answer.

I encourage you to read this post on OAuth and how it relates to this exact question to better understand the methodology. Simply put, you may not want to log the user out of Asana when they log out of your application, but I will leave you to decide that :)

Instead of logging the user out you may try a warning message when the user logs out of your application:

"Warning: Remember to log out of the Asana App"

If you really want to have a button that logs the user out of Asana and redirects back to your own website, try implementing an iframe like this

    <html>
    <script>
        function logout() {
            var i = document.createElement('iframe');
            i.style.display = 'none';
            i.onload = function () {
                i.parentNode.removeChild(i);
            };
            i.src = 'https://app.asana.com/-/logout';
            document.body.appendChild(i);
        }
    </script>
    <a href="/logout" onclick="logout();">Logout</a>
    </html>
Community
  • 1
  • 1
Andrew Noonan
  • 848
  • 6
  • 13
-1

I recently discovered Bridge24, a great extension for Asana https://bridge24.com/

You can't logout from Asana if you're not in Asana... normal I think. The extension doesn't have a logout process. You can only logout from your own app.

  • Thanks for the input. I have finished my app. The only part I am worried about is the logout functionality. I am able to do both by using the asana logout link I mentioned, but then I am not able to redirect user to my login page. – AKSH May 13 '15 at 15:41