Difference between revisions of "MOR API user login"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 13: Line 13:
* u - username to login (or email if [[Configuration_from_GUI#Various | Allow login by email]] is enabled). '''Required'''.
* u - username to login (or email if [[Configuration_from_GUI#Various | Allow login by email]] is enabled). '''Required'''.
* p - Password to login. '''Required'''.
* p - Password to login. '''Required'''.
<! 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 '''params''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required''' (if setting '''Disable hash checking''' is not checked).
<br><br>
<br><br>


===Request===
===Request===

Revision as of 15:54, 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 check added since X16 sprint S253 http://trac.kolmisoft.com/trac/ticket/16208#comment:2 -->




Request

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

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