log out user vipps (oauth2 ?)

A

Anonymous

Guest
I'm new at doing webpages with PHP. I have problem with logging out from my "vipps" login, it's similar to oauth2 I have read.. I have searched the web and tried many different solution, but the only way I make it work is when I go into the "vipps" app and remove my browser from "browser that remember you.

At this site I read that I only can log out with disabling session.
https://github.com/vippsas/vipps-login-api/blob/master/vipps-login-api-faq.md#why-can-i-get-userinfo-after-the-user-has-revoked-consent

Vipps Login does not support merchant initiated logout in the browser as this would effectively log the user out of Vipps Login (meaning that the user will no longer be remembered in the browser across sites that use Vipps Login). You are of course free to log the user out of your service (by disabling your own session).

If a user wants to log out of a specific browser remembered in Vipps Login, they need to do this in the Vipps app by navigating to:
Profile->Personal Information->Browsers that remember you, select a browser and press the logout button.


If I use incognito mode and login, then close my browser and open it again then I have to login. So I guess there should be a solution for my problem.

I have current code in a users.php file:
public function logout(){
$this->user = null;
$_SESSION['vipsUserInfo'] = null;
$hostname = $_SERVER['HTTP_HOST'];
header("Location: https://".$hostname);
session_destroy();
exit;
}

and this in a logout.php
require_once __DIR__ . '/TSS/vips/src/auth/Users.php';
$vipsAuth = new VipsUsers();
$vipsAuth->logout();
$hostname = $_SERVER['HTTP_HOST'];
header("Location: https://".$hostname);
die;

Does anyone have some good solutions for me?

Thanks in advanced, I'm very newbish so I need all the tips I could get.
 
Back
Top