Jump to content
php.lv forumi

OAuth 2.0


eT`

Recommended Posts

Tātad, gribu izveidot sekojošu sistēmu, bet atdūros pret šķērsli.

Gribu savā projektā pievienot OAuth 2.0

Pieliku, ka pēc pogas nospiešanas pārmet uz šo saiti:

https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&state=%2Fprofile&redirect_uri=http%3A%2F%2Fmypage.com&response_type=token&client_id=client_key

 

un savā pusē es novalidēju e-pastu


$tokenget = explode("&",$_COOKIE["answer"]);
$token = explode("=",$tokenget[1]);
$data = file_get_contents("https://www.googleapis.com/oauth2/v1/userinfo?access_token=".$token[1]);
$data = json_decode($data);
if(stristr($data->email,"mypage.com")) {
//viss ok
}

 

bet problēma ir tajā gadījumā, ja cilvēks ir ielogojies ar citu e-pastu googlē nevis ar @mypage.com

ja nav ielogojies ar nevienu vai ir ielogojies ar @mypage.com tad viss ir kārtībā.

Īpaši neesmu ar šo darbojies tāpēc nezinu `work-aroundus` , kā pie novalidēt ar viena noteikta domēna atļaujām

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...