SePay OAuth 2.0 Overview

Learn about SePay OAuth 2.0 authentication for third-party app integration. Understand scopes, grant flows, and how to access SePay APIs on behalf of users.

||

Introduction

SePay has implemented OAuth 2.0 authentication mechanism, enabling partners to integrate easily and securely with our system. This documentation provides detailed guidance on using OAuth 2.0 to connect with SePay API endpoints.

What is OAuth 2.0?

OAuth 2.0 is a standard authorization protocol that allows third-party applications to access user resources without needing to know their login credentials.

OAuth 2.0 SePay
Click to expand
OAuth 2.0 SePay

OAuth 2.0 provides the following benefits:

  • Secure: No need to share login credentials with third-party applications
  • Controlled: Users can limit the scope of access for applications
  • Flexible: Easy to revoke access without changing passwords
  • Standardized: Widely supported and adopted by many online services

Benefits of Using OAuth 2.0 with SePay

Implementing OAuth 2.0 provides significant benefits when integrating with SePay:

High Security

Secure authentication without sharing login credentials, minimizing security risks.

Granular Permissions

Detailed access control for each endpoint, helping you manage data and features being accessed.

Limited Access Scope

Restrict access scope for third-party applications, ensuring only necessary permissions are granted.

Refresh Token

Token refresh mechanism to maintain secure connections without re-authentication.

Scopes

SePay defines scopes to control access to each API:

ScopeDescription
bank-account:readPermission to read bank account information
transaction:readPermission to read transaction information
webhook:readPermission to read webhook information
webhook:writePermission to write webhook information
webhook:deletePermission to delete webhook information
profilePermission to read user information
companyPermission to read company information

When registering an application, you can request one or more scopes. Users will be prompted to authorize when authenticating.

OAuth 2.0 Flow Overview

The OAuth 2.0 flow in SePay follows the standard authentication process with the following steps:

1
Register Application

Obtain `client_id` and `client_secret` from SePay through the Developer Portal.

2
Request Authorization

Redirect users to SePay authentication screen to grant permissions.

3
Receive Authorization Code

SePay redirects users back to your application with an authorization code.

4
Exchange Code for Token

Send API request to SePay to exchange authorization code for access token.

5
Use Token

Include access token in API request headers for authentication.

6
Refresh Token

Use refresh token to obtain new access token when expired.

Details about each step in the OAuth 2.0 flow are fully documented in the Authentication Flow section

API Base URL

All SePay OAuth 2.0 APIs use a common base URL: https://my.sepay.vn/api/v1

When making API requests, you need to append the specific endpoint path after the base URL. For example:

EndpointFull URLDescription
/bank-accountshttps://my.sepay.vn/api/v1/bank-accountsAPI to get list of bank accounts
/transactionshttps://my.sepay.vn/api/v1/transactionsAPI to get list of transactions
/webhookshttps://my.sepay.vn/api/v1/webhooksAPI to manage webhooks
/mehttps://my.sepay.vn/api/v1/meAPI to get current user information
/companieshttps://my.sepay.vn/api/v1/companiesAPI to get company information

API Versioning

The "v1" part in the base URL represents the API version. SePay uses this versioning system to ensure compatibility when changes are made in the future.

  • Current version: v1 (https://my.sepay.vn/api/v1)

When a new API version is released, SePay will announce and update the documentation. We always ensure the old API version is maintained for a reasonable period to allow applications time to update.

Note

All API requests must include an Access Token in the Authorization header as described in the Access Token section.