Logging in

From DreamFactory
Jump to: navigation, search
(Created page with "### Tutorial ### Log in as an Admin The Admin login API is api/v2/system/admin/session #### API Endpoint <pre>POST https://your-url/api/v2/system/admin/session</pre> <sour...")
(Logging in as a User (non-admin))
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
### Tutorial
+
=== Logging in as an Admin ===
  
### Log in as an Admin
+
The Admin login API endpoint is api/v2/system/admin/session
  
The Admin login API is api/v2/system/admin/session
+
Request URL:
  
#### API Endpoint
+
<pre>POST https://foo.com/api/v2/system/admin/session</pre>
  
<pre>POST https://your-url/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
+
  
<pre>POST https://your-url/api/v2/system/admin/session</pre>
 
 
<source lang="JavaScript">
 
<source lang="JavaScript">
 
{
 
{
   "email": "jdoe@example.com",
+
   "email": "admin@example.com",
 
   "password": "secret",
 
   "password": "secret",
 
   "remember_me": false
 
   "remember_me": false
Line 27: Line 17:
 
</source>
 
</source>
  
Note: Set remember_me flag to 'true' in order to get a JWT (token) that can be refreshed forever (until logout) without authentication.
+
cURL:
  
### Log in as an User (non-admin)
+
<pre>curl -i -k -3 -X POST "https://foo.com/api/v2/system/admin/session" -d '{ "email" : "admin@example.com", "password" : "secret" }' -H "Content-Type: application/json"</pre>
  
The User login API is api/v2/user/session
+
Note: Set remember_me=true to get a JWT (token) that can be refreshed forever (until logout) without authentication.''
  
#### API Endpoint
+
=== Logging in as a User (Non-Admin) ===
  
<pre>POST https://your-url/api/v2/user/session</pre>
+
The non-admin login API endpoint is api/v2/user/session
<source lang="JavaScript">
+
 
{
+
Request URL:
  "email": "user_email",
+
  "password": "password",
+
  "remember_me": bool
+
}
+
</source>
+
  
#### Example - Logging in as an User (non-admin)
+
<pre>POST https://foo.com/api/v2/user/session</pre>
 +
 
 +
Request body:
  
<pre>POST https://your-url/api/v2/user/session</pre>
 
 
<source lang="JavaScript">
 
<source lang="JavaScript">
 
{
 
{
   "email": "jdoe@example.com",
+
   "email": "user@example.com",
 
   "password": "secret",
 
   "password": "secret",
 
   "remember_me": false
 
   "remember_me": false
Line 55: Line 41:
 
</source>
 
</source>
  
Note: Set remember_me flag to 'true' in order to get a JWT (token) that can be refreshed forever (until logout) without authentication.
+
cURL:
 +
 
 +
<pre>curl -i -k -3 -X POST "https://foo.com/api/v2/user/session" -d '{ "email" : "user@example.com", "password" : "secret" }' -H "Content-Type: application/json"</pre>
 +
 
 +
Note: Set remember_me=true to get a JWT (token) that can be refreshed forever (until logout) without authentication.''

Latest revision as of 20:38, 14 July 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": "admin@example.com",
  "password": "secret",
  "remember_me": false
}

cURL:

curl -i -k -3 -X POST "https://foo.com/api/v2/system/admin/session" -d '{ "email" : "admin@example.com", "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.

Logging 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": "user@example.com",
  "password": "secret",
  "remember_me": false
}

cURL:

curl -i -k -3 -X POST "https://foo.com/api/v2/user/session" -d '{ "email" : "user@example.com", "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.