Search

MachPanel Knowledgebase

HOW TO:Configure OAuth2 Authentication For Rest API

Rehan Waseem
MachPanel

Summary

This article provides information about how to configure and use OAuth2 authentication for Rest API in MachPanel

Applies To

MachPanel v7 and above

Overview

The OAuth 2.0 authorization framework is a protocol that allows a user to grant a third-party web site or application access to the user's protected resources, without necessarily revealing their long-term credentials or even their identity.

Authentication

To enable OAuth2 for Rest API, Navigate to System Configuration > Company Profile > API Settings.

  • Under Rest API Settings, click the OAuth2 from the authentication types, Set the Token Expire time and click Save

Using the API

The API platform used is Postman API Platform. This can be downloaded from this link

  • Generate Access Token
    • Enter the URL of your panel ending with /api/token
    • Then add the following Key and value as shown below
      • Grant Type must be set to 'password'
      • Username value should the API Login set under API Settings (System Configuration > Company Profile > API Settings)
      • Password value should be the API Password set under API Settings (System Configuration > Company Profile > API Settings)
    •  
    • After that you can click on Send to generate Access Token
    • ​​
  • Extracting the data
    • Copy the Access Token generated
    • Go to Authorization tab and choose the Type Bearer Token
    • Enter the URL (example shown for extracting the customer data having id=6)
    •  Paste the Access Token under the field of Token and click Send
    • The data extracted will be shown as below
Details
Type: HOW TO
Level: Beginner
Last Modified: 2 days ago @ 12:39 PM
Last Modified By: rehan_waseem
Article not rated yet.
Article has been viewed 48 times.
Options
Also In This Category
Tags