Updated SDKs
This commit is contained in:
parent
b3d0df54aa
commit
8943ba9642
18 changed files with 124 additions and 134 deletions
|
@ -15,11 +15,11 @@ class Auth extends Service {
|
|||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// added your platforms in the console interface.
|
||||
///
|
||||
/// When not using the success or failure redirect arguments this endpoint will
|
||||
/// result with a 200 status code and the user account object on success and
|
||||
/// with 401 status error on failure. This behavior was applied to help the web
|
||||
/// clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
/// needed for saving the account session token.
|
||||
/// When accessing this route using Javascript from the browser, success and
|
||||
/// failure parameter URLs are required. Appwrite server will respond with a
|
||||
/// 301 redirect status code and will set the user session cookie. This
|
||||
/// behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
/// in XHR of fetch request to protect user privacy.
|
||||
Future<Response> login({email, password, success, failure}) async {
|
||||
String path = '/auth/login';
|
||||
|
||||
|
@ -80,12 +80,12 @@ class Auth extends Service {
|
|||
/// values attached to the URL query string. Use the query string params to
|
||||
/// submit a request to the /auth/password/reset endpoint to complete the
|
||||
/// process.
|
||||
Future<Response> recovery({email, redirect}) async {
|
||||
Future<Response> recovery({email, confirmation}) async {
|
||||
String path = '/auth/recovery';
|
||||
|
||||
Map<String, dynamic> params = {
|
||||
'email': email,
|
||||
'redirect': redirect,
|
||||
'confirmation': confirmation,
|
||||
};
|
||||
|
||||
return await this.client.call('post', path: path, params: params);
|
||||
|
@ -117,7 +117,7 @@ class Auth extends Service {
|
|||
///
|
||||
/// If registration completes successfully user will be sent with a
|
||||
/// confirmation email in order to confirm he is the owner of the account email
|
||||
/// address. Use the redirect parameter to redirect the user from the
|
||||
/// address. Use the confirmation parameter to redirect the user from the
|
||||
/// confirmation email back to your app. When the user is redirected, use the
|
||||
/// /auth/confirm endpoint to complete the account confirmation.
|
||||
///
|
||||
|
@ -126,18 +126,18 @@ class Auth extends Service {
|
|||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// added your platforms in the console interface.
|
||||
///
|
||||
/// When not using the success or failure redirect arguments this endpoint will
|
||||
/// result with a 200 status code and the user account object on success and
|
||||
/// with 401 status error on failure. This behavior was applied to help the web
|
||||
/// clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
/// needed for saving the account session token.
|
||||
Future<Response> register({email, password, redirect, success, failure, name = null}) async {
|
||||
/// When accessing this route using Javascript from the browser, success and
|
||||
/// failure parameter URLs are required. Appwrite server will respond with a
|
||||
/// 301 redirect status code and will set the user session cookie. This
|
||||
/// behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
/// in XHR of fetch request to protect user privacy.
|
||||
Future<Response> register({email, password, confirmation, success = null, failure = null, name = null}) async {
|
||||
String path = '/auth/register';
|
||||
|
||||
Map<String, dynamic> params = {
|
||||
'email': email,
|
||||
'password': password,
|
||||
'redirect': redirect,
|
||||
'confirmation': confirmation,
|
||||
'success': success,
|
||||
'failure': failure,
|
||||
'name': name,
|
||||
|
@ -167,11 +167,11 @@ class Auth extends Service {
|
|||
/// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
|
||||
/// the only valid redirect URL's are the once from domains you have set when
|
||||
/// added your platforms in the console interface.
|
||||
Future<Response> confirmResend({redirect}) async {
|
||||
Future<Response> confirmResend({confirmation}) async {
|
||||
String path = '/auth/register/confirm/resend';
|
||||
|
||||
Map<String, dynamic> params = {
|
||||
'redirect': redirect,
|
||||
'confirmation': confirmation,
|
||||
};
|
||||
|
||||
return await this.client.call('post', path: path, params: params);
|
||||
|
|
|
@ -4,7 +4,7 @@ sdk
|
|||
setProject('')
|
||||
;
|
||||
|
||||
let promise = sdk.auth.register('email@example.com', 'password', 'https://example.com', 'https://example.com', 'https://example.com');
|
||||
let promise = sdk.auth.register('email@example.com', 'password', 'https://example.com');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -4,7 +4,7 @@ sdk
|
|||
setProject('')
|
||||
;
|
||||
|
||||
let promise = sdk.projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
|
||||
let promise = sdk.projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -4,7 +4,7 @@ sdk
|
|||
setProject('')
|
||||
;
|
||||
|
||||
let promise = sdk.projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
|
||||
let promise = sdk.projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -500,11 +500,11 @@
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
*
|
||||
* @param {string} email
|
||||
* @param {string} password
|
||||
|
@ -648,16 +648,16 @@
|
|||
* process.
|
||||
*
|
||||
* @param {string} email
|
||||
* @param {string} redirect
|
||||
* @param {string} confirmation
|
||||
* @throws {Error}
|
||||
* @return {Promise} */
|
||||
recovery: function(email, redirect) {
|
||||
recovery: function(email, confirmation) {
|
||||
if(email === undefined) {
|
||||
throw new Error('Missing required parameter: "email"');
|
||||
}
|
||||
|
||||
if(redirect === undefined) {
|
||||
throw new Error('Missing required parameter: "redirect"');
|
||||
if(confirmation === undefined) {
|
||||
throw new Error('Missing required parameter: "confirmation"');
|
||||
}
|
||||
|
||||
let path = '/auth/recovery';
|
||||
|
@ -666,7 +666,7 @@
|
|||
.post(path, {'content-type': 'application/json'},
|
||||
{
|
||||
'email': email,
|
||||
'redirect': redirect
|
||||
'confirmation': confirmation
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -727,7 +727,7 @@
|
|||
*
|
||||
* If registration completes successfully user will be sent with a
|
||||
* confirmation email in order to confirm he is the owner of the account email
|
||||
* address. Use the redirect parameter to redirect the user from the
|
||||
* address. Use the confirmation parameter to redirect the user from the
|
||||
* confirmation email back to your app. When the user is redirected, use the
|
||||
* /auth/confirm endpoint to complete the account confirmation.
|
||||
*
|
||||
|
@ -736,21 +736,21 @@
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
*
|
||||
* @param {string} email
|
||||
* @param {string} password
|
||||
* @param {string} redirect
|
||||
* @param {string} confirmation
|
||||
* @param {string} success
|
||||
* @param {string} failure
|
||||
* @param {string} name
|
||||
* @throws {Error}
|
||||
* @return {null} */
|
||||
register: function(email, password, redirect, success, failure, name = '') {
|
||||
register: function(email, password, confirmation, success = '', failure = '', name = '') {
|
||||
if(email === undefined) {
|
||||
throw new Error('Missing required parameter: "email"');
|
||||
}
|
||||
|
@ -759,16 +759,8 @@
|
|||
throw new Error('Missing required parameter: "password"');
|
||||
}
|
||||
|
||||
if(redirect === undefined) {
|
||||
throw new Error('Missing required parameter: "redirect"');
|
||||
}
|
||||
|
||||
if(success === undefined) {
|
||||
throw new Error('Missing required parameter: "success"');
|
||||
}
|
||||
|
||||
if(failure === undefined) {
|
||||
throw new Error('Missing required parameter: "failure"');
|
||||
if(confirmation === undefined) {
|
||||
throw new Error('Missing required parameter: "confirmation"');
|
||||
}
|
||||
|
||||
let path = '/auth/register';
|
||||
|
@ -776,7 +768,7 @@
|
|||
return iframe('post', path, {project: config.project,
|
||||
'email': email,
|
||||
'password': password,
|
||||
'redirect': redirect,
|
||||
'confirmation': confirmation,
|
||||
'success': success,
|
||||
'failure': failure,
|
||||
'name': name
|
||||
|
@ -826,12 +818,12 @@
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* @param {string} redirect
|
||||
* @param {string} confirmation
|
||||
* @throws {Error}
|
||||
* @return {Promise} */
|
||||
confirmResend: function(redirect) {
|
||||
if(redirect === undefined) {
|
||||
throw new Error('Missing required parameter: "redirect"');
|
||||
confirmResend: function(confirmation) {
|
||||
if(confirmation === undefined) {
|
||||
throw new Error('Missing required parameter: "confirmation"');
|
||||
}
|
||||
|
||||
let path = '/auth/register/confirm/resend';
|
||||
|
@ -839,7 +831,7 @@
|
|||
return http
|
||||
.post(path, {'content-type': 'application/json'},
|
||||
{
|
||||
'redirect': redirect
|
||||
'confirmation': confirmation
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
18
app/sdks/js/src/sdk.min.js
vendored
18
app/sdks/js/src/sdk.min.js
vendored
|
@ -26,21 +26,19 @@ let path='/auth/logout/{id}'.replace(new RegExp('{id}','g'),id);return http.dele
|
|||
if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||
if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
let path='/auth/oauth/callback/{provider}/{projectId}'.replace(new RegExp('{projectId}','g'),projectId).replace(new RegExp('{provider}','g'),provider);return http.get(path,{'content-type':'application/json'},{'code':code,'state':state})},oauth:function(provider,success='',failure=''){if(provider===undefined){throw new Error('Missing required parameter: "provider"')}
|
||||
let path='/auth/oauth/{provider}'.replace(new RegExp('{provider}','g'),provider);return http.get(path,{'content-type':'application/json'},{'success':success,'failure':failure})},recovery:function(email,redirect){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||
if(redirect===undefined){throw new Error('Missing required parameter: "redirect"')}
|
||||
let path='/auth/recovery';return http.post(path,{'content-type':'application/json'},{'email':email,'redirect':redirect})},recoveryReset:function(userId,token,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
let path='/auth/oauth/{provider}'.replace(new RegExp('{provider}','g'),provider);return http.get(path,{'content-type':'application/json'},{'success':success,'failure':failure})},recovery:function(email,confirmation){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||
if(confirmation===undefined){throw new Error('Missing required parameter: "confirmation"')}
|
||||
let path='/auth/recovery';return http.post(path,{'content-type':'application/json'},{'email':email,'confirmation':confirmation})},recoveryReset:function(userId,token,passwordA,passwordB){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
if(token===undefined){throw new Error('Missing required parameter: "token"')}
|
||||
if(passwordA===undefined){throw new Error('Missing required parameter: "passwordA"')}
|
||||
if(passwordB===undefined){throw new Error('Missing required parameter: "passwordB"')}
|
||||
let path='/auth/recovery/reset';return http.put(path,{'content-type':'application/json'},{'userId':userId,'token':token,'password-a':passwordA,'password-b':passwordB})},register:function(email,password,redirect,success,failure,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||
let path='/auth/recovery/reset';return http.put(path,{'content-type':'application/json'},{'userId':userId,'token':token,'password-a':passwordA,'password-b':passwordB})},register:function(email,password,confirmation,success='',failure='',name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')}
|
||||
if(password===undefined){throw new Error('Missing required parameter: "password"')}
|
||||
if(redirect===undefined){throw new Error('Missing required parameter: "redirect"')}
|
||||
if(success===undefined){throw new Error('Missing required parameter: "success"')}
|
||||
if(failure===undefined){throw new Error('Missing required parameter: "failure"')}
|
||||
let path='/auth/register';return iframe('post',path,{project:config.project,'email':email,'password':password,'redirect':redirect,'success':success,'failure':failure,'name':name})},confirm:function(userId,token){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
if(confirmation===undefined){throw new Error('Missing required parameter: "confirmation"')}
|
||||
let path='/auth/register';return iframe('post',path,{project:config.project,'email':email,'password':password,'confirmation':confirmation,'success':success,'failure':failure,'name':name})},confirm:function(userId,token){if(userId===undefined){throw new Error('Missing required parameter: "userId"')}
|
||||
if(token===undefined){throw new Error('Missing required parameter: "token"')}
|
||||
let path='/auth/register/confirm';return http.post(path,{'content-type':'application/json'},{'userId':userId,'token':token})},confirmResend:function(redirect){if(redirect===undefined){throw new Error('Missing required parameter: "redirect"')}
|
||||
let path='/auth/register/confirm/resend';return http.post(path,{'content-type':'application/json'},{'redirect':redirect})}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
let path='/auth/register/confirm';return http.post(path,{'content-type':'application/json'},{'userId':userId,'token':token})},confirmResend:function(confirmation){if(confirmation===undefined){throw new Error('Missing required parameter: "confirmation"')}
|
||||
let path='/auth/register/confirm/resend';return http.post(path,{'content-type':'application/json'},{'confirmation':confirmation})}};let avatars={getBrowser:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);return http.get(path,{'content-type':'application/json'},{'width':width,'height':height,'quality':quality})},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);return http.get(path,{'content-type':'application/json'},{'width':width,'height':height,'quality':quality})},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
|
||||
let path='/avatars/favicon';return http.get(path,{'content-type':'application/json'},{'url':url})},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
|
||||
|
|
|
@ -10,7 +10,7 @@ client
|
|||
setKey('')
|
||||
;
|
||||
|
||||
let promise = auth.register('email@example.com', 'password', 'https://example.com', 'https://example.com', 'https://example.com');
|
||||
let promise = auth.register('email@example.com', 'password', 'https://example.com');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -10,7 +10,7 @@ client
|
|||
setKey('')
|
||||
;
|
||||
|
||||
let promise = projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
|
||||
let promise = projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -10,7 +10,7 @@ client
|
|||
setKey('')
|
||||
;
|
||||
|
||||
let promise = projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 0);
|
||||
let promise = projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 1);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response);
|
||||
|
|
|
@ -14,11 +14,11 @@ class Auth extends Service {
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
*
|
||||
* @param string email
|
||||
* @param string password
|
||||
|
@ -126,17 +126,17 @@ class Auth extends Service {
|
|||
* process.
|
||||
*
|
||||
* @param string email
|
||||
* @param string redirect
|
||||
* @param string confirmation
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async recovery(email, redirect) {
|
||||
async recovery(email, confirmation) {
|
||||
let path = '/auth/recovery';
|
||||
|
||||
return await this.client.call('post', path, {'content-type': 'application/json'},
|
||||
{
|
||||
'email': email,
|
||||
'redirect': redirect
|
||||
'confirmation': confirmation
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ class Auth extends Service {
|
|||
*
|
||||
* If registration completes successfully user will be sent with a
|
||||
* confirmation email in order to confirm he is the owner of the account email
|
||||
* address. Use the redirect parameter to redirect the user from the
|
||||
* address. Use the confirmation parameter to redirect the user from the
|
||||
* confirmation email back to your app. When the user is redirected, use the
|
||||
* /auth/confirm endpoint to complete the account confirmation.
|
||||
*
|
||||
|
@ -190,29 +190,29 @@ class Auth extends Service {
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
*
|
||||
* @param string email
|
||||
* @param string password
|
||||
* @param string redirect
|
||||
* @param string confirmation
|
||||
* @param string success
|
||||
* @param string failure
|
||||
* @param string name
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async register(email, password, redirect, success, failure, name = '') {
|
||||
async register(email, password, confirmation, success = '', failure = '', name = '') {
|
||||
let path = '/auth/register';
|
||||
|
||||
return await this.client.call('post', path, {'content-type': 'application/json'},
|
||||
{
|
||||
'email': email,
|
||||
'password': password,
|
||||
'redirect': redirect,
|
||||
'confirmation': confirmation,
|
||||
'success': success,
|
||||
'failure': failure,
|
||||
'name': name
|
||||
|
@ -254,16 +254,16 @@ class Auth extends Service {
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* @param string redirect
|
||||
* @param string confirmation
|
||||
* @throws Exception
|
||||
* @return {}
|
||||
*/
|
||||
async confirmResend(redirect) {
|
||||
async confirmResend(confirmation) {
|
||||
let path = '/auth/register/confirm/resend';
|
||||
|
||||
return await this.client.call('post', path, {'content-type': 'application/json'},
|
||||
{
|
||||
'redirect': redirect
|
||||
'confirmation': confirmation
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ POST https://appwrite.test/v1/auth/login
|
|||
|
||||
Please notice that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.
|
||||
|
||||
When not using the success or failure redirect arguments this endpoint will result with a 200 status code and the user account object on success and with 401 status error on failure. This behavior was applied to help the web clients deal with browsers who don't allow to set 3rd party HTTP cookies needed for saving the account session token. **
|
||||
When accessing this route using Javascript from the browser, success and failure parameter URLs are required. Appwrite server will respond with a 301 redirect status code and will set the user session cookie. This behavior is enforced because modern browsers are limiting 3rd party cookies in XHR of fetch request to protect user privacy. **
|
||||
|
||||
### Parameters
|
||||
|
||||
|
@ -85,7 +85,7 @@ POST https://appwrite.test/v1/auth/recovery
|
|||
| Field Name | Type | Description | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| email | string | User account email address. | |
|
||||
| redirect | string | Reset page in your app to redirect user after reset token has been sent to user email. | |
|
||||
| confirmation | string | Reset page URL in your app to redirect user after reset token has been sent to user email. | |
|
||||
|
||||
## Password Reset
|
||||
|
||||
|
@ -114,11 +114,11 @@ POST https://appwrite.test/v1/auth/register
|
|||
|
||||
** Use this endpoint to allow a new user to register an account in your project. Use the success and failure URL's to redirect users back to your application after signup completes.
|
||||
|
||||
If registration completes successfully user will be sent with a confirmation email in order to confirm he is the owner of the account email address. Use the redirect parameter to redirect the user from the confirmation email back to your app. When the user is redirected, use the /auth/confirm endpoint to complete the account confirmation.
|
||||
If registration completes successfully user will be sent with a confirmation email in order to confirm he is the owner of the account email address. Use the confirmation parameter to redirect the user from the confirmation email back to your app. When the user is redirected, use the /auth/confirm endpoint to complete the account confirmation.
|
||||
|
||||
Please notice that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface.
|
||||
|
||||
When not using the success or failure redirect arguments this endpoint will result with a 200 status code and the user account object on success and with 401 status error on failure. This behavior was applied to help the web clients deal with browsers who don't allow to set 3rd party HTTP cookies needed for saving the account session token. **
|
||||
When accessing this route using Javascript from the browser, success and failure parameter URLs are required. Appwrite server will respond with a 301 redirect status code and will set the user session cookie. This behavior is enforced because modern browsers are limiting 3rd party cookies in XHR of fetch request to protect user privacy. **
|
||||
|
||||
### Parameters
|
||||
|
||||
|
@ -126,7 +126,7 @@ When not using the success or failure redirect arguments this endpoint will resu
|
|||
| --- | --- | --- | --- |
|
||||
| email | string | Account email | |
|
||||
| password | string | User password | |
|
||||
| redirect | string | Confirmation page to redirect user after confirm token has been sent to user email | |
|
||||
| confirmation | string | Confirmation URL to redirect user after confirm token has been sent to user email | |
|
||||
| success | string | Redirect when registration succeed | |
|
||||
| failure | string | Redirect when registration failed | |
|
||||
| name | string | User name | |
|
||||
|
@ -160,5 +160,5 @@ Please notice that in order to avoid a [Redirect Attacks](https://github.com/OWA
|
|||
|
||||
| Field Name | Type | Description | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| redirect | string | Confirmation page to redirect user to your app after confirm token has been sent to user email. | |
|
||||
| confirmation | string | Confirmation page to redirect user to your app after confirm token has been sent to user email. | |
|
||||
|
||||
|
|
|
@ -12,4 +12,4 @@ $client
|
|||
|
||||
$auth = new Auth($client);
|
||||
|
||||
$result = $auth->register('email@example.com', 'password', 'https://example.com', 'https://example.com', 'https://example.com');
|
||||
$result = $auth->register('email@example.com', 'password', 'https://example.com');
|
|
@ -12,4 +12,4 @@ $client
|
|||
|
||||
$projects = new Projects($client);
|
||||
|
||||
$result = $projects->createTask('[PROJECT_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
|
||||
$result = $projects->createTask('[PROJECT_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com');
|
|
@ -12,4 +12,4 @@ $client
|
|||
|
||||
$projects = new Projects($client);
|
||||
|
||||
$result = $projects->updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com');
|
||||
$result = $projects->updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');
|
|
@ -20,11 +20,11 @@ class Auth extends Service
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
*
|
||||
* @param string $email
|
||||
* @param string $password
|
||||
|
@ -142,17 +142,17 @@ class Auth extends Service
|
|||
* process.
|
||||
*
|
||||
* @param string $email
|
||||
* @param string $redirect
|
||||
* @param string $confirmation
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function recovery($email, $redirect)
|
||||
public function recovery($email, $confirmation)
|
||||
{
|
||||
$path = str_replace([], [], '/auth/recovery');
|
||||
$params = [];
|
||||
|
||||
$params['email'] = $email;
|
||||
$params['redirect'] = $redirect;
|
||||
$params['confirmation'] = $confirmation;
|
||||
|
||||
return $this->client->call(Client::METHOD_POST, $path, [
|
||||
], $params);
|
||||
|
@ -201,7 +201,7 @@ class Auth extends Service
|
|||
*
|
||||
* If registration completes successfully user will be sent with a
|
||||
* confirmation email in order to confirm he is the owner of the account email
|
||||
* address. Use the redirect parameter to redirect the user from the
|
||||
* address. Use the confirmation parameter to redirect the user from the
|
||||
* confirmation email back to your app. When the user is redirected, use the
|
||||
* /auth/confirm endpoint to complete the account confirmation.
|
||||
*
|
||||
|
@ -210,29 +210,29 @@ class Auth extends Service
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* When not using the success or failure redirect arguments this endpoint will
|
||||
* result with a 200 status code and the user account object on success and
|
||||
* with 401 status error on failure. This behavior was applied to help the web
|
||||
* clients deal with browsers who don't allow to set 3rd party HTTP cookies
|
||||
* needed for saving the account session token.
|
||||
* When accessing this route using Javascript from the browser, success and
|
||||
* failure parameter URLs are required. Appwrite server will respond with a
|
||||
* 301 redirect status code and will set the user session cookie. This
|
||||
* behavior is enforced because modern browsers are limiting 3rd party cookies
|
||||
* in XHR of fetch request to protect user privacy.
|
||||
*
|
||||
* @param string $email
|
||||
* @param string $password
|
||||
* @param string $redirect
|
||||
* @param string $confirmation
|
||||
* @param string $success
|
||||
* @param string $failure
|
||||
* @param string $name
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function register($email, $password, $redirect, $success, $failure, $name = '')
|
||||
public function register($email, $password, $confirmation, $success = '', $failure = '', $name = '')
|
||||
{
|
||||
$path = str_replace([], [], '/auth/register');
|
||||
$params = [];
|
||||
|
||||
$params['email'] = $email;
|
||||
$params['password'] = $password;
|
||||
$params['redirect'] = $redirect;
|
||||
$params['confirmation'] = $confirmation;
|
||||
$params['success'] = $success;
|
||||
$params['failure'] = $failure;
|
||||
$params['name'] = $name;
|
||||
|
@ -278,16 +278,16 @@ class Auth extends Service
|
|||
* the only valid redirect URL's are the once from domains you have set when
|
||||
* added your platforms in the console interface.
|
||||
*
|
||||
* @param string $redirect
|
||||
* @param string $confirmation
|
||||
* @throws Exception
|
||||
* @return array
|
||||
*/
|
||||
public function confirmResend($redirect)
|
||||
public function confirmResend($confirmation)
|
||||
{
|
||||
$path = str_replace([], [], '/auth/register/confirm/resend');
|
||||
$params = [];
|
||||
|
||||
$params['redirect'] = $redirect;
|
||||
$params['confirmation'] = $confirmation;
|
||||
|
||||
return $this->client->call(Client::METHOD_POST, $path, [
|
||||
], $params);
|
||||
|
|
|
@ -60,13 +60,13 @@ class Auth(Service):
|
|||
return self.client.call('get', path, {
|
||||
}, params)
|
||||
|
||||
def recovery(self, email, redirect):
|
||||
def recovery(self, email, confirmation):
|
||||
"""Password Recovery"""
|
||||
|
||||
params = {}
|
||||
path = '/auth/recovery'
|
||||
params['email'] = email
|
||||
params['redirect'] = redirect
|
||||
params['confirmation'] = confirmation
|
||||
|
||||
return self.client.call('post', path, {
|
||||
}, params)
|
||||
|
@ -84,14 +84,14 @@ class Auth(Service):
|
|||
return self.client.call('put', path, {
|
||||
}, params)
|
||||
|
||||
def register(self, email, password, redirect, success, failure, name=''):
|
||||
def register(self, email, password, confirmation, success='', failure='', name=''):
|
||||
"""Register User"""
|
||||
|
||||
params = {}
|
||||
path = '/auth/register'
|
||||
params['email'] = email
|
||||
params['password'] = password
|
||||
params['redirect'] = redirect
|
||||
params['confirmation'] = confirmation
|
||||
params['success'] = success
|
||||
params['failure'] = failure
|
||||
params['name'] = name
|
||||
|
@ -110,12 +110,12 @@ class Auth(Service):
|
|||
return self.client.call('post', path, {
|
||||
}, params)
|
||||
|
||||
def confirm_resend(self, redirect):
|
||||
def confirm_resend(self, confirmation):
|
||||
"""Resend Confirmation"""
|
||||
|
||||
params = {}
|
||||
path = '/auth/register/confirm/resend'
|
||||
params['redirect'] = redirect
|
||||
params['confirmation'] = confirmation
|
||||
|
||||
return self.client.call('post', path, {
|
||||
}, params)
|
||||
|
|
|
@ -63,12 +63,12 @@ module Appwrite
|
|||
}, params);
|
||||
end
|
||||
|
||||
def recovery(email:, redirect:)
|
||||
def recovery(email:, confirmation:)
|
||||
path = '/auth/recovery'
|
||||
|
||||
params = {
|
||||
'email': email,
|
||||
'redirect': redirect
|
||||
'confirmation': confirmation
|
||||
}
|
||||
|
||||
return @client.call('post', path, {
|
||||
|
@ -89,13 +89,13 @@ module Appwrite
|
|||
}, params);
|
||||
end
|
||||
|
||||
def register(email:, password:, redirect:, success:, failure:, name: '')
|
||||
def register(email:, password:, confirmation:, success: '', failure: '', name: '')
|
||||
path = '/auth/register'
|
||||
|
||||
params = {
|
||||
'email': email,
|
||||
'password': password,
|
||||
'redirect': redirect,
|
||||
'confirmation': confirmation,
|
||||
'success': success,
|
||||
'failure': failure,
|
||||
'name': name
|
||||
|
@ -117,11 +117,11 @@ module Appwrite
|
|||
}, params);
|
||||
end
|
||||
|
||||
def confirm_resend(redirect:)
|
||||
def confirm_resend(confirmation:)
|
||||
path = '/auth/register/confirm/resend'
|
||||
|
||||
params = {
|
||||
'redirect': redirect
|
||||
'confirmation': confirmation
|
||||
}
|
||||
|
||||
return @client.call('post', path, {
|
||||
|
|
|
@ -36,7 +36,7 @@ $cli
|
|||
|
||||
$clients = [
|
||||
'php' => [
|
||||
'version' => 'v1.0.7',
|
||||
'version' => '1.0.8',
|
||||
'result' => __DIR__.'/../sdks/php/',
|
||||
'gitURL' => 'https://github.com/appwrite/sdk-for-php.git',
|
||||
'gitRepo' => 'git@github.com:appwrite/sdk-for-php.git',
|
||||
|
@ -46,7 +46,7 @@ $cli
|
|||
'platform' => 'server',
|
||||
],
|
||||
'js' => [
|
||||
'version' => 'v1.0.20',
|
||||
'version' => '1.0.21',
|
||||
'result' => __DIR__.'/../sdks/js/',
|
||||
'gitURL' => 'https://github.com/appwrite/sdk-for-js.git',
|
||||
'gitRepo' => 'git@github.com:appwrite/sdk-for-js.git',
|
||||
|
@ -56,7 +56,7 @@ $cli
|
|||
'platform' => 'client',
|
||||
],
|
||||
'node' => [
|
||||
'version' => 'v1.0.24',
|
||||
'version' => '1.0.25',
|
||||
'result' => __DIR__.'/../sdks/node/',
|
||||
'gitURL' => 'https://github.com/appwrite/sdk-for-node.git',
|
||||
'gitRepo' => 'git@github.com:appwrite/sdk-for-node.git',
|
||||
|
@ -66,7 +66,7 @@ $cli
|
|||
'platform' => 'server',
|
||||
],
|
||||
'python' => [
|
||||
'version' => 'v1.0.0',
|
||||
'version' => '1.0.0',
|
||||
'result' => __DIR__.'/../sdks/python/',
|
||||
'gitURL' => 'https://github.com/appwrite/sdk-for-python.git',
|
||||
'gitRepo' => 'git@github.com:appwrite/sdk-for-python.git',
|
||||
|
@ -76,7 +76,7 @@ $cli
|
|||
'platform' => 'server',
|
||||
],
|
||||
'ruby' => [
|
||||
'version' => 'v1.0.0',
|
||||
'version' => '1.0.1',
|
||||
'result' => __DIR__.'/../sdks/ruby/',
|
||||
'gitURL' => 'https://github.com/appwrite/sdk-for-ruby.git',
|
||||
'gitRepo' => 'git@github.com:appwrite/sdk-for-ruby.git',
|
||||
|
@ -86,7 +86,7 @@ $cli
|
|||
'platform' => 'server',
|
||||
],
|
||||
'dart' => [
|
||||
'version' => '0.0.1',
|
||||
'version' => '0.0.2',
|
||||
'result' => __DIR__.'/../sdks/dart/',
|
||||
'gitURL' => 'https://github.com/appwrite/sdk-for-dart',
|
||||
'gitRepo' => 'git@github.com:appwrite/sdk-for-dart.git',
|
||||
|
|
Loading…
Reference in a new issue