mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
New OAuth e2e test
This commit is contained in:
1 parent
d005ade2d8
commit
178d45cabf
6 files changed
+77
-11
No files matched your search
@@ -29,7 +29,7 @@ class Mock extends OAuth
|
||||
*/
|
||||
public function getLoginURL():string
|
||||
{
|
||||
return 'http://localhost/'.$this->version.'/oauth?client_id='.urlencode($this->appID).'&redirect_uri='.urlencode($this->callback).'&scope=email&state='.urlencode(json_encode($this->state));
|
||||
return 'http://localhost/'.$this->version.'/mock/tests/general/oauth?client_id='.urlencode($this->appID).'&redirect_uri='.urlencode($this->callback).'&scope=email&state='.urlencode(json_encode($this->state));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,13 +41,15 @@ class Mock extends OAuth
|
||||
{
|
||||
$accessToken = $this->request(
|
||||
'GET',
|
||||
'http://localhost/'.$this->version.'/oauth/token?'.
|
||||
'http://localhost/'.$this->version.'/mock/tests/general/oauth/token?'.
|
||||
'client_id='.urlencode($this->appID).
|
||||
'&redirect_uri='.urlencode($this->callback).
|
||||
'&client_secret='.urlencode($this->appSecret).
|
||||
'&code='.urlencode($code)
|
||||
);
|
||||
|
||||
var_dump($this->appSecret);
|
||||
var_dump($accessToken);
|
||||
$accessToken = json_decode($accessToken, true); //
|
||||
|
||||
if (isset($accessToken['access_token'])) {
|
||||
@@ -113,7 +115,7 @@ class Mock extends OAuth
|
||||
protected function getUser(string $accessToken):array
|
||||
{
|
||||
if (empty($this->user)) {
|
||||
$user = $this->request('GET', 'http://localhost/'.$this->version.'/oauth/user?token='.urlencode($accessToken));
|
||||
$user = $this->request('GET', 'http://localhost/'.$this->version.'/mock/tests/general/oauth/user?token='.urlencode($accessToken));
|
||||
|
||||
$this->user = json_decode($user, true);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user