Avideo: signIn API

Created on 2 Oct 2020  路  16Comments  路  Source: WWBN/AVideo

Hi,

I'm using the signIn API then redirects to the AVideo Platform after signIn success but what happens is the account used didn't login to the Platform after redirected. I think it's needs modification on how to set the cookie, need help on this. Thank you!

help wanted

Most helpful comment

No problem, but it is good to learn

https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request

All 16 comments

how exactly are you using? if is inside an iframe cross domain it will probably not work due security reasons

check this https://stackoverflow.com/questions/3342140/cross-domain-cookies

the solution is to pass the user and the encrypted pass every request.

I'm using ajax request same as the first answer on that thread, the cookie still not saving when I checked but when I tried to customized the method on saving cookie before on the signIn API it works for me.

yes, if you request from another domain it will not save cookies.

again, cross domain cookies are not allowed.

what do you mean with "I tried to customized the method on saving cookie"?

$cookie_options = array(
'expires' => time() + 606024*30,
'path' => '/',
'domain' => $_SERVER['HTTP_HOST'],
'secure' => true,
'httponly' => false,
'samesite' => 'None'
);

setcookie("name", $cookie, $options);


I think I made it like this before, passing options

you can try to modify it in your files, I do not think it will work, also this code rise errors in some PHP Versions.

if works please let me know, I will modify the main code.

ok, I will inform you when I make it work again, thank you

great thanks

hello I tried again and it's working

Can we do something like this ??
if (version_compare(phpversion(), '7.2', '>')) { $cookie_options = array( 'expires' => $expires, 'path' => '/', 'domain' => $_SERVER['HTTP_HOST'], 'secure' => true, 'httponly' => false, 'samesite' => 'None' ); setcookie("rememberme", $rememberme, $cookie_options); setcookie("user", $user['user'], $cookie_options); setcookie("pass", $user['password'], $cookie_options); } else { _setcookie("rememberme", $rememberme, $expires); _setcookie("user", $user['user'], $expires); _setcookie("pass", $user['password'], $expires); }

this is how was before.

so are you saying with this works cross domain?

yes, same ajax request and no changes needed for the header on backend/signin api for my case

Check this update, but next time please make a pull request.

Sorry not too familiar with pull request, will do that next time, I will pull now your changes wait a sec.

No problem, but it is good to learn

https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request

Thanks! I will look at it

$cookie_options not used on the update

Sorry you were right. here is another update

Working fine now, thank you so much! :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matthall1998 picture matthall1998  路  4Comments

shebanet picture shebanet  路  4Comments

akhilleusuggo picture akhilleusuggo  路  3Comments

KazeroG picture KazeroG  路  4Comments

wetubeclub picture wetubeclub  路  3Comments