Skip to content

Commit 01e6c67

Browse files
committed
Initial commit
1 parent d4a07ef commit 01e6c67

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

docs/auth.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Auth Service
22

3-
## Login User
3+
## Login
44

55
```http request
66
POST https://appwrite.io/v1/auth/login
@@ -21,6 +21,20 @@ When accessing this route using Javascript from the browser, success and failure
2121
| success | string | URL to redirect back to your app after a successful login attempt. | |
2222
| failure | string | URL to redirect back to your app after a failed login attempt. | |
2323

24+
## Login with OAuth
25+
26+
```http request
27+
GET https://appwrite.io/v1/auth/login/oauth/{provider}
28+
```
29+
30+
### Parameters
31+
32+
| Field Name | Type | Description | Default |
33+
| --- | --- | --- | --- |
34+
| provider | string | **Required** OAuth Provider | |
35+
| success | string | **Required** URL to redirect back to your app after a successful login attempt. | |
36+
| failure | string | **Required** URL to redirect back to your app after a failed login attempt. | |
37+
2438
## Logout Current Session
2539

2640
```http request
@@ -43,20 +57,6 @@ DELETE https://appwrite.io/v1/auth/logout/{id}
4357
| --- | --- | --- | --- |
4458
| id | string | **Required** User specific session unique ID number. if 0 delete all sessions. | |
4559

46-
## OAuth Login
47-
48-
```http request
49-
GET https://appwrite.io/v1/auth/oauth/{provider}
50-
```
51-
52-
### Parameters
53-
54-
| Field Name | Type | Description | Default |
55-
| --- | --- | --- | --- |
56-
| provider | string | **Required** OAuth Provider | |
57-
| success | string | **Required** URL to redirect back to your app after a successful login attempt. | |
58-
| failure | string | **Required** URL to redirect back to your app after a failed login attempt. | |
59-
6060
## Password Recovery
6161

6262
```http request
@@ -91,7 +91,7 @@ Please notice that in order to avoid a [Redirect Attack](https://github.com/OWAS
9191
| password-a | string | New password. | |
9292
| password-b | string | New password again. | |
9393

94-
## Register User
94+
## Register
9595

9696
```http request
9797
POST https://appwrite.io/v1/auth/register
@@ -116,7 +116,7 @@ When accessing this route using Javascript from the browser, success and failure
116116
| failure | string | Redirect when registration failed | |
117117
| name | string | User name | |
118118

119-
## Confirm User
119+
## Confirmation
120120

121121
```http request
122122
POST https://appwrite.io/v1/auth/register/confirm

src/Appwrite/Services/Auth.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class Auth extends Service
1010
{
1111
/**
12-
* Login User
12+
* Login
1313
*
1414
* Allow the user to login into his account by providing a valid email and
1515
* password combination. Use the success and failure arguments to provide a
@@ -48,6 +48,28 @@ public function login(string $email, string $password, string $success = '', str
4848
], $params);
4949
}
5050

51+
/**
52+
* Login with OAuth
53+
*
54+
* @param string $provider
55+
* @param string $success
56+
* @param string $failure
57+
* @throws Exception
58+
* @return array
59+
*/
60+
public function oauth(string $provider, string $success, string $failure):array
61+
{
62+
$path = str_replace(['{provider}'], [$provider], '/auth/login/oauth/{provider}');
63+
$params = [];
64+
65+
$params['success'] = $success;
66+
$params['failure'] = $failure;
67+
68+
return $this->client->call(Client::METHOD_GET, $path, [
69+
'content-type' => 'application/json',
70+
], $params);
71+
}
72+
5173
/**
5274
* Logout Current Session
5375
*
@@ -91,28 +113,6 @@ public function logoutBySession(string $id):array
91113
], $params);
92114
}
93115

94-
/**
95-
* OAuth Login
96-
*
97-
* @param string $provider
98-
* @param string $success
99-
* @param string $failure
100-
* @throws Exception
101-
* @return array
102-
*/
103-
public function oauth(string $provider, string $success, string $failure):array
104-
{
105-
$path = str_replace(['{provider}'], [$provider], '/auth/oauth/{provider}');
106-
$params = [];
107-
108-
$params['success'] = $success;
109-
$params['failure'] = $failure;
110-
111-
return $this->client->call(Client::METHOD_GET, $path, [
112-
'content-type' => 'application/json',
113-
], $params);
114-
}
115-
116116
/**
117117
* Password Recovery
118118
*
@@ -177,7 +177,7 @@ public function recoveryReset(string $userId, string $token, string $passwordA,
177177
}
178178

179179
/**
180-
* Register User
180+
* Register
181181
*
182182
* Use this endpoint to allow a new user to register an account in your
183183
* project. Use the success and failure URLs to redirect users back to your
@@ -227,7 +227,7 @@ public function register(string $email, string $password, string $confirm, strin
227227
}
228228

229229
/**
230-
* Confirm User
230+
* Confirmation
231231
*
232232
* Use this endpoint to complete the confirmation of the user account email
233233
* address. Both the **userId** and **token** arguments will be passed as

0 commit comments

Comments
 (0)