Authenticate a user » History » Version 5
Eric Vieillevigne, 05/12/2015 03:29 PM
| 1 | 1 | Eric Vieillevigne | {{>toc}} |
|---|---|---|---|
| 2 | 2 | Eric Vieillevigne | |
| 3 | 5 | Eric Vieillevigne | h1. Authentication - _*log*_ method (deprecated) |
| 4 | 1 | Eric Vieillevigne | |
| 5 | In order to use the API you must be a valid user and be authenticated by the platform. First you have to create an account. In order to perform this tasks you shall use the API. |
||
| 6 | |||
| 7 | h2. Account Creation - _logcreate_ |
||
| 8 | |||
| 9 | This method creates a new account into the platform with at least one email |
||
| 10 | Open a session with the created account, even if the account identifier is not validated yet. (see loginByPassword for detail about the session). |
||
| 11 | |||
| 12 | By sending an HTTP request http://stagingapi.familywall.com/api/log/create?identifier=mynewid%40de.de&password=mynewpassword |
||
| 13 | |||
| 14 | *Parameters*: |
||
| 15 | |||
| 16 | |*Name*|*Type*|*Description*| |
||
| 17 | |Login|String|Login Information| |
||
| 18 | |Password|String|Password Information| |
||
| 19 | |||
| 20 | *Response*: |
||
| 21 | <pre><code class="javascript"> |
||
| 22 | { |
||
| 23 | "a01":{ |
||
| 24 | "r":{ |
||
| 25 | "r":"675" |
||
| 26 | }, |
||
| 27 | "cn":"logcreate" |
||
| 28 | } |
||
| 29 | } |
||
| 30 | </code></pre> |
||
| 31 | The Method response is a *Long* which represents the _AccountId_ of the account created . |
||
| 32 | |||
| 33 | In case, the method encounter any error, the response is an exeception with specific parameters detailed below. |
||
| 34 | |||
| 35 | *Error*: |
||
| 36 | |||
| 37 | |*Error Code*|*Type*|*Value*|*Description*| |
||
| 38 | |FizAccountAlreadyExistsException|Ex|2|Login already exists| |
||
| 39 | |FizCredentialInvalidException|Ex|3|Authentication Exception| |
||
| 40 | |||
| 41 | h2. Account Authentication- _login_ |
||
| 42 | |||
| 43 | In order to log-in into the platform and create a session, the _log_ method shall be called. By calling http://stagingapi.familywall.com/api/log/in? |
||
| 44 | |||
| 45 | identifier=accid&password=pwd the system will provide a session token enabling the client application to perform authenticated operations. However this is transparent to the API |
||
| 46 | |||
| 47 | because this is sent via the api session layer (usually under the form of a JSESSIONID). |
||
| 48 | |||
| 49 | *Parameters*: |
||
| 50 | |||
| 51 | |*Name*|*Type*|*Description*| |
||
| 52 | |identifier|String|Account Information Id| |
||
| 53 | |Password|String|Password Information| |
||
| 54 | |||
| 55 | *Response*: |
||
| 56 | <pre><code class="javascript"> |
||
| 57 | { |
||
| 58 | "a01":{ |
||
| 59 | "r":{ |
||
| 60 | "r":"130" |
||
| 61 | }, |
||
| 62 | "cn":"login" |
||
| 63 | } |
||
| 64 | } |
||
| 65 | </code></pre> |
||
| 66 | The Method response is a *Long* which represents the _AccountId_ of the account logged. |
||
| 67 | |||
| 68 | In case, the method encounter any error, the response is an exeception with specific parameters detailed below. |
||
| 69 | |||
| 70 | *Error*: |
||
| 71 | |||
| 72 | |*Error Code*|*Type*|*Value*|*Description*| |
||
| 73 | |FizAccountIdentifierNotValidatedException|Ex|4|Email is not validated yet| |
||
| 74 | |FizCredentialInvalidException|Ex|3|Authentication Exception| |
||
| 75 | |FizAccountNotFoundException|Ex|1|Account does not exists| |
||
| 76 | |||
| 77 | h2. Account Log Out- _logout_ |
||
| 78 | |||
| 79 | The client can call the method logout to terminate the session initiated by the methog login. |
||
| 80 | |||
| 81 | http://stagingapi.familywall.com/api/log/out |
||
| 82 | |||
| 83 | *Parameters*: |
||
| 84 | The method does not necessitate a parameter. It uses the JSESSIONID stored on the session cookie to request to the server the session invalidation |
||
| 85 | |||
| 86 | *Response*: |
||
| 87 | <pre><code class="javascript"> |
||
| 88 | { |
||
| 89 | "a01":{ |
||
| 90 | "r":{ |
||
| 91 | "r":"true" |
||
| 92 | }, |
||
| 93 | "cn":"logout" |
||
| 94 | } |
||
| 95 | } |
||
| 96 | </code></pre> |
||
| 97 | The Method response is a *Boolean* which returns *TRUE* as a results when session is effectively invalidated and *FALSE* when the session does not exists anymore. |
||
| 98 | |||
| 99 | In case, the method encounter any error, the response is an exeception with specific parameters detailed below. |
||
| 100 | |||
| 101 | *Error*: |
||
| 102 | |*Error Code*|*Type*|*Value*|*Description*| |
||
| 103 | |FizAccountNotFoundInSessionException|un|501|Session is invalid| |
||
| 104 | |FizApiInvalidParameterException|un|502|invalid token| |
||
| 105 | |FizApiModelDoesNotExistException|un|503|Object does not exists| |
||
| 106 | |FizApiModelRightException|un|504|Right exception to use this method| |
||
| 107 | |||
| 108 | h2. Account Validation- _logtoken_ |
||
| 109 | |||
| 110 | The logtoken method is used to validate an account identifier. If the account identifier is existing, the account identifier shall not be verified yet. If the validation Token |
||
| 111 | |||
| 112 | is ok, the account identifier is validated and a session with the account is opened. If the validation token is invalid, the FizCredentialInvalidException will be thrown. |
||
| 113 | |||
| 114 | http://stagingapi.familywall.com/api/log/token?identifier=id&token=string |
||
| 115 | |||
| 116 | *Parameters*: |
||
| 117 | |||
| 118 | |*Name*|*Type*|*Description*| |
||
| 119 | |identifier|String|Account Information Id| |
||
| 120 | |Token|String|Token Information| |
||
| 121 | |||
| 122 | *Response*: |
||
| 123 | <pre><code class="javascript"> |
||
| 124 | { |
||
| 125 | "a01":{ |
||
| 126 | "r":{ |
||
| 127 | "r":"130" |
||
| 128 | }, |
||
| 129 | "cn":"logtoken" |
||
| 130 | } |
||
| 131 | } |
||
| 132 | </code></pre> |
||
| 133 | The Method response is a *Long* which represents the _AccountId_ of the account logged. |
||
| 134 | |||
| 135 | In case, the method encounter any error, the response is an exeception with specific parameters detailed below. |
||
| 136 | |||
| 137 | *Error*: |
||
| 138 | |||
| 139 | |*Error Code*|*Type*|*Value*|*Description*| |
||
| 140 | |FizCredentialInvalidException|Ex|3|Authentication Exception| |
||
| 141 | |FizAccountNotFoundException|Ex|1|Account does not exists| |
||
| 142 | |FizAccountNotFoundInSessionException|un|501|Session is invalid| |
||
| 143 | |FizApiInvalidParameterException|un|502|invalid token| |
||
| 144 | |FizApiModelDoesNotExistException|un|503|Object does not exists| |
||
| 145 | |FizApiModelRightException|un|504|Right exception to use this method| |