Difference between revisions of "MOR API user login"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[MOR API]]
=Description=


Logs in user into MOR
[[MOR API]] Logs in user into MOR
<br><br>
=Usage=


 
* From '''MOR X4''' call: '''/api/user_login'''
* For Backwards-compatibility old name 'login' is also usable. Call: '''/api/login'''
* Methods: POST, GET(if allowed, not recomended)
<br><br>
===Parameters=== 


==Request==
* u - username to login (or email if [[Configuration_from_GUI#Various | Allow login by email]] is enabled). '''Required'''.
* p - Password to login. '''Required'''.


HTML POST: http://<SERVER_IP>/billing/api/login?u=username&p=password
<!--- Hash check added since X16 sprint S253 http://trac.kolmisoft.com/trac/ticket/16208#comment:2 -->
* [[MOR API hash construction | hash]] - SHA1 hash constructed using '''parameters''' above and '''API_Secret_Key'''. '''Required''' (if setting '''Disable hash checking''' is not checked).
<br><br>


==Result==
 
===Request===
 
HTML POST: http://<SERVER_IP>/billing/api/user_login?u=username&p=password&hash=6e79d4a82f68102f43be11d873177f47817f84df
 
===Returns===
 
'''Success'''. Everything is ok. User is logged into the system you get:


  <?xml version="1.0" encoding="utf-8" standalone="yes"?>
  <?xml version="1.0" encoding="utf-8" standalone="yes"?>
Line 15: Line 31:
     <name>login</name>
     <name>login</name>
     <status>ok</status>
     <status>ok</status>
     <user_id>54</user_id>    #this line was added on MOR11
     <user_id>user_id</user_id>    #this line was added on MOR11
    <status_message>Successfully logged in</status_message>
   </action>
   </action>
----


Everything is ok. User is logged in to the system.
'''Error'''
 
----


  <?xml version="1.0" encoding="utf-8" standalone="yes"?>
  <?xml version="1.0" encoding="utf-8" standalone="yes"?>
Line 27: Line 42:
     <name>login</name>
     <name>login</name>
     <status>failed</status>
     <status>failed</status>
    <status_message>Login failed</status_message>
   </action>
   </action>
   
   
This means that wrong username and/or password and user can't be authenticated.
This means that wrong username and/or password and user can't be authenticated.
<br><br>
<br><br>


==Customer redirect==
=Advanced options=
 
<!---This functionality is available from MOR 9--->
''This option is available starting from [[MOR_9_documentation | MOR 9]]''
 
To redirect customer to MOR Billing main site go to: '''SETTINGS -> Setup -> Settings -> API''' and check the marked option:
To redirect customer to MOR Billing main site go to: '''SETTINGS -> Setup -> Settings -> API''' and check the marked option:
<br><br>
<br><br>
Line 54: Line 66:


This means that wrong username and/or password and user can't be authenticated.
This means that wrong username and/or password and user can't be authenticated.
<br><br>
=See also=
* [http://wiki.kolmisoft.com/index.php/MOR_API MOR API]

Latest revision as of 16:02, 2 March 2021

Description

MOR API Logs in user into MOR

Usage

  • From MOR X4 call: /api/user_login
  • For Backwards-compatibility old name 'login' is also usable. Call: /api/login
  • Methods: POST, GET(if allowed, not recomended)



Parameters

  • u - username to login (or email if Allow login by email is enabled). Required.
  • p - Password to login. Required.
  • hash - SHA1 hash constructed using parameters above and API_Secret_Key. Required (if setting Disable hash checking is not checked).




Request

HTML POST: http://<SERVER_IP>/billing/api/user_login?u=username&p=password&hash=6e79d4a82f68102f43be11d873177f47817f84df

Returns

Success. Everything is ok. User is logged into the system you get:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <action>
   <name>login</name>
   <status>ok</status>
   <user_id>user_id</user_id>    #this line was added on MOR11
   <status_message>Successfully logged in</status_message>
 </action>

Error

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <action>
   <name>login</name>
   <status>failed</status>
   <status_message>Login failed</status_message>
 </action>

This means that wrong username and/or password and user can't be authenticated.

Advanced options

To redirect customer to MOR Billing main site go to: SETTINGS -> Setup -> Settings -> API and check the marked option:

Mor api redirect.png

If login over API is successful the customer will be redirected to MOR Billing main site.

If login is not successful :

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <action>
   <name>login</name>
   <status>failed</status>
 </action>

This means that wrong username and/or password and user can't be authenticated.

See also