login in symfony with podio user through podio api
I'm developing a symfony app, and I want it to be like a front end of podio, so users can login in my app with their podio users and work within my app.
I'm using the latest symfony version 5.3 and the library podio-php.
When user logs in my app then I do:
try {
Podio::authenticate_with_password($data["_email"], $data["_password"]);
$session = $this->requestStack->getSession();
$access_token = Podio::$oauth->access_token;
$refresh_token = Podio::$oauth->refresh_token;
$expires_in = Podio::$oauth->expires_in;
$ref = Podio::$oauth->ref;
$session->set('access_token', $access_token);
$session->set('refresh_token', $refresh_token);
$session->set('expires_in', $expires_in);
$session->set('ref', $ref);
$session->set('email', $data["_email"]);
$ses = $this->requestStack->getSession();
return $this->render('dev/dump.html.twig' , ['variable' => $ses ]);}
catch(PodioError $e) {
return $this->render('dev/dump.html.twig' , ['variable' => $e->body['error_description']]);
}
So I have the apiKey from podio and the refresh token in the symfony session and I can do api requests to Podio with them. But Symfony do not recognizes user as logged in. I know I have to change the user provider in the security.yaml, but I don't know how to change it for symfony to recognize user as logged in.
I made a custom authenticator for the apiKey as it is explained here: https://symfony.com/doc/current/security/guard_authentication.html
but I still see in the profiler user "authenticated: no" and that there is "no security token" so, even when I logged in in Podio through my app successfully, I'm not logged in in my symfony app with an stateless user provided by Podio.
I tried to ask in stack overflow before, but maybe because I couldn't express clearly what I needed nobody answered even though I offered 100 points as a reward.
https://stackoverflow.com/questions/68032853/login-in-symfony-with-podio-php
I've been stuck for a week with the login, can somebody help me please?
Please sign in to leave a comment.
Comments
0 comments