Skip to content

Commit

Permalink
Updated Redirect URL to Authorisation URL & MArkup
Browse files Browse the repository at this point in the history
  • Loading branch information
Priyanka-Deriv committed Jun 7, 2024
1 parent 070508f commit 3effb9c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 14 deletions.
6 changes: 3 additions & 3 deletions docs/core-concepts/authorization-authentication/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ Here is the visual representation of how the OAuth authorisation connection work

## The authentication process

In order to authenticate your user, specify the URL that will be used as the OAuth Redirect URL on the [Dashboard](/dashboard) page, **Register application** tab in the **OAuth details** fields. Then, add a login button on your website or app and direct users to **`https://oauth.deriv.com/oauth2/authorize?app_id=your_app_id`** where your_app_id is the ID of your app.
In order to authenticate your user, specify the URL that will be used as the OAuth Authorisation URL on the [Dashboard](/dashboard) page, **Register application** tab in the **OAuth details** fields. Then, add a login button on your website or app and direct users to **`https://oauth.deriv.com/oauth2/authorize?app_id=your_app_id`** where your_app_id is the ID of your app.

![Deriv OAuth Login](/img/oauth_login.png 'Deriv OAuth Login')

Once a user signs up/logs in, they will be redirected to the URL that you entered as the Redirect URL. This URL will have arguments added to it with the user's session tokens, and will look similar to this:
Once a user signs up/logs in, they will be redirected to the URL that you entered as the Authorisation URL. This URL will have arguments added to it with the user's session tokens, and will look similar to this:

`https://[YOUR_WEBSITE_URL]/redirect/?acct1=cr799393& token1=a1-f7pnteezo4jzhpxclctizt27hyeot&cur1=usd& acct2=vrtc1859315& token2=a1clwe3vfuuus5kraceykdsoqm4snfq& cur2=usd`

## The authorisation process

The query parameters in the redirect URL are the user's accounts and their related session tokens. You can map the query parameters to an array using the following approach:
The query parameters in the Authorisation URL are the user's accounts and their related session tokens. You can map the query parameters to an array using the following approach:

```js showLineNumbers
const user_accounts = [
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/guides/about-the-deriv-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Here are the steps to use the Deriv API:

2. **Familiarise yourself with the API documentation**: The Deriv API provides comprehensive documentation that explains how to use the API endpoints, including the available parameters and response formats. Make sure you are familiar with the documentation before you start using the API.

3. **Create an API application**: To create an API application, you need to provide a name for your application and a redirect URI. The redirect URI is the URL that the user will be redirected to after they have authorised your application to access their Deriv account.
3. **Create an API application**: To create an API application, you need to provide a name for your application and a Authorisation URL. The Authorisation URL is the URL that the user will be redirected to after they have authorised your application to access their Deriv account.

4. **Authorise your application**: Once you have created your API application, you need to authorise it to access your Deriv account. This involves logging into your Deriv account and granting permission for your application to access your account data.

Expand Down
21 changes: 21 additions & 0 deletions docs/guides/monetizing-the-deriv-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,24 @@ There are several ways to monetize the Deriv API:
5. **Advertising**: If you have built a trading application that has a large user base, you could consider selling advertising space to relevant advertisers. This can be a good way to generate additional revenue.

6. **Markup**: Use the Deriv API to create your own websites and apps, and earn commissions on the trades and payments your clients make, monetizing your creations through markup.

## Markup

Boost your revenue by applying markups on every contract purchased through the trading app you've developed using the Deriv API. You can set the markup yourself, up to a maximum of 3%.

Supported trade types include: Options, Multipliers, and Accumulators.

Here's an example of how the markup is calculated:

To get a payout of **2.00 USD**:

- Client stake without markup = **1.07 USD**

With the markup (e.g. 2%), a client pays:

- Client's stake with the markup = Stake + (payout x markup)
- Client's stake with the markup = 1.07 USD + (2 USD x 2%) = **1.11 USD**

## Earning commission

Earn commissions on trades and payments made by your clients through the websites and apps you create with the Deriv API. Get more details about the commission plans [here](https://www.deriv.com/partners/affiliate-ib).
4 changes: 2 additions & 2 deletions docs/guides/oauth2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ For more information on OAuth2, [see this guide](https://aaronparecki.com/oauth-

### How to use OAuth authorisation

1. Specify the URL that will be used as the **OAuth Authentication URL** on the app registration page in the **Website URL field**.
1. Specify the URL that will be used as the **OAuth Authorisation URL** on the app registration page in the **Website URL field**.

2. Add a login button on your website or app and direct users to `https://oauth.deriv.com/oauth2/authorize?app_id=your_app_id` where your_app_id is the ID of your app.

3. Once a user signs up, they will be redirected to the URL that you entered as the **Authentication URL**. This URL will have arguments added to it with the user's session tokens, and will look similar to: `https://[YOUR_WEBSITE_URL]/redirect/?acct1=cr799393& token1=a1-f7pnteezo4jzhpxclctizt27hyeot&cur1=usd& acct2=vrtc1859315& token2=a1clwe3vfuuus5kraceykdsoqm4snfq& cur2=usd&state=`
3. Once a user signs up, they will be redirected to the URL that you entered as the **Authorisation URL**. This URL will have arguments added to it with the user's session tokens, and will look similar to: `https://[YOUR_WEBSITE_URL]/redirect/?acct1=cr799393& token1=a1-f7pnteezo4jzhpxclctizt27hyeot&cur1=usd& acct2=vrtc1859315& token2=a1clwe3vfuuus5kraceykdsoqm4snfq& cur2=usd&state=`

4. In the parameters of the URL, you will see all the accounts and the session token for each account. Pass these tokens to the Authorize API call in order to perform actions on behalf of the account.
16 changes: 8 additions & 8 deletions docs/setting-up-a-deriv-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ You need a token with the `Admin` scope to create an application.

To create your application with the appropriate configuration options, select the **Register Application** tab in the Dashboard. You can make changes to your application's configuration at anytime in the **Manage Applications** tab.

| App information field | Description |
| --------------------- | -------------------------------------------------------------------------------------------------- |
| Account | The account you want to create the application with |
| API Token | The API token you want to create the application with |
| App Name | Application name |
| Markup | The commission added to the trade price to earn additional income |
| Authorisation URL | The URL that enables clients to log in to your app using their Deriv accounts without an API token |
| Verification URL | The OAuth redirect URL for the OAuth authorisation |
| App information field | Description |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Account | The account you want to create the application with |
| API Token | The API token you want to create the application with |
| App Name | Application name |
| Markup | The commission added to the trade price to earn additional income |
| Authorisation URL | The URL that enables clients to log in to your app using their Deriv accounts without an API token |
| Verification URL | Used for email verification. If provided, the URL with the verification token is sent to the user's email; otherwise, the Authentication URL is used. |

**To create an application, follow these steps:**

Expand Down

0 comments on commit 3effb9c

Please sign in to comment.