Logging in

From DreamFactory
Jump to: navigation, search
Line 1: Line 1:
=== Log in as an Admin ===
+
=== Logging in as an Admin ===
  
The Admin login API is api/v2/system/admin/session
+
The Admin login API endpoint is api/v2/system/admin/session
  
==== API Endpoint ====
+
Request URL
  
<pre>POST https://{url}/api/v2/system/admin/session</pre>
+
<pre>POST https://foo.com/api/v2/system/admin/session</pre>
Request body:
+
<source lang="JavaScript">
+
{
+
  "email": "user_email",
+
  "password": "password",
+
  "remember_me": bool
+
}
+
</source>
+
  
==== Example - Logging in as an Admin ====
+
Request body
  
* Request body:
 
 
<source lang="JavaScript">
 
<source lang="JavaScript">
 
{
 
{
   "email": "jdoe@example.com",
+
   "email": "admin@example.com",
 
   "password": "secret",
 
   "password": "secret",
 
   "remember_me": false
 
   "remember_me": false
 
}
 
}
 
</source>
 
</source>
* Request URL:
 
<pre>POST https://foo.com/api/v2/system/admin/session</pre>
 
  
 +
cURL
  
    ''Note: Set remember_me flag to 'true' in order to get a JWT (token) that can be refreshed forever (until logout) without authentication.''
+
<pre>curl -i -k -3 -X POST "http://localhost:8080/api/v2/system/admin/session" -d '{ "email" : "[email protected].com", "password" : "secret" }' -H "Content-Type: application/json"</pre>
  
* cURL:
+
Note: Set remember_me=true to get a JWT (token) that can be refreshed forever (until logout) without authentication.''
  
<pre>curl -i -k -3 -X POST "http://localhost:8080/api/v2/system/admin/session" -d '{ "email" : "[email protected]", "password" : "some_password" }' -H "Content-Type: application/json"</pre>
+
=== Log in as a User (non-admin) ===
  
=== Log in as an User (non-admin) ===
+
The non-admin login API endpoint is api/v2/user/session
  
The User login API is api/v2/user/session
+
Request URL
  
==== API Endpoint ====
+
<pre>POST https://foo.com/api/v2/user/session</pre>
  
<pre>POST https://{url}api/v2/user/session</pre>
+
Request body
Request body:
+
<source lang="JavaScript">
+
{
+
  "email": "user_email",
+
  "password": "password",
+
  "remember_me": bool
+
}
+
</source>
+
 
+
==== Example - Logging in as an User (non-admin) ====
+
  
* Request body:
 
 
<source lang="JavaScript">
 
<source lang="JavaScript">
 
{
 
{
   "email": "jdoe@example.com",
+
   "email": "user@example.com",
 
   "password": "secret",
 
   "password": "secret",
 
   "remember_me": false
 
   "remember_me": false
 
}
 
}
 
</source>
 
</source>
* Request URL:
 
<pre>POST https://foo.com/api/v2/user/session</pre>
 
  
 +
cURL
 +
 +
<pre>curl -i -k -3 -X POST "http://localhost:8080/api/v2/user/session" -d '{ "email" : "[email protected]", "password" : "secret" }' -H "Content-Type: application/json"</pre>
  
    ''Note: Set remember_me flag to 'true' in order to get a JWT (token) that can be refreshed forever (until logout) without authentication.''
+
Note: Set remember_me=true to get a JWT (token) that can be refreshed forever (until logout) without authentication.''

Revision as of 18:36, 30 June 2016

Logging in as an Admin

The Admin login API endpoint is api/v2/system/admin/session

Request URL

POST https://foo.com/api/v2/system/admin/session

Request body

{
  "email": "[email protected]",
  "password": "secret",
  "remember_me": false
}

cURL

curl -i -k -3 -X POST "http://localhost:8080/api/v2/system/admin/session" -d '{ "email" : "[email protected]", "password" : "secret" }' -H "Content-Type: application/json"

Note: Set remember_me=true to get a JWT (token) that can be refreshed forever (until logout) without authentication.

Log in as a User (non-admin)

The non-admin login API endpoint is api/v2/user/session

Request URL

POST https://foo.com/api/v2/user/session

Request body

{
  "email": "[email protected]",
  "password": "secret",
  "remember_me": false
}

cURL

curl -i -k -3 -X POST "http://localhost:8080/api/v2/user/session" -d '{ "email" : "[email protected]", "password" : "secret" }' -H "Content-Type: application/json"

Note: Set remember_me=true to get a JWT (token) that can be refreshed forever (until logout) without authentication.