Skip to content

Latest commit

 

History

History
164 lines (120 loc) · 4.1 KB

LoginApi.md

File metadata and controls

164 lines (120 loc) · 4.1 KB

UpstoxClient.LoginApi

All URIs are relative to https://api-v2.upstox.com

Method HTTP request Description
authorize GET /login/authorization/dialog Authorize API
logout DELETE /logout Logout
token POST /login/authorization/token Get token API

authorize

authorize(clientId, redirectUri, apiVersion, opts)

Authorize API

This provides details on the login endpoint.

Example

import {UpstoxClient} from 'upstox-js-sdk';

let apiInstance = new UpstoxClient.LoginApi();
let clientId = "clientId_example"; // String | 
let redirectUri = "redirectUri_example"; // String | 
let apiVersion = "apiVersion_example"; // String | API Version Header
let opts = { 
  'state': "state_example", // String | 
  'scope': "scope_example" // String | 
};
apiInstance.authorize(clientId, redirectUri, apiVersion, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
clientId String
redirectUri String
apiVersion String API Version Header
state String [optional]
scope String [optional]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, /

logout

LogoutResponse logout(apiVersion)

Logout

Logout

Example

import {UpstoxClient} from 'upstox-js-sdk';
let defaultClient = UpstoxClient.ApiClient.instance;

// Configure OAuth2 access token for authorization: OAUTH2
let OAUTH2 = defaultClient.authentications['OAUTH2'];
OAUTH2.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new UpstoxClient.LoginApi();
let apiVersion = "apiVersion_example"; // String | API Version Header

apiInstance.logout(apiVersion, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
apiVersion String API Version Header

Return type

LogoutResponse

Authorization

OAUTH2

HTTP request headers

  • Content-Type: Not defined
  • Accept: /, application/json

token

TokenResponse token(apiVersion, opts)

Get token API

This API provides the functionality to obtain opaque token from authorization_code exchange and also provides the user’s profile in the same response.

Example

import {UpstoxClient} from 'upstox-js-sdk';

let apiInstance = new UpstoxClient.LoginApi();
let apiVersion = "apiVersion_example"; // String | API Version Header
let opts = { 
  'code': "code_example", // String | 
  'clientId': "clientId_example", // String | 
  'clientSecret': "clientSecret_example", // String | 
  'redirectUri': "redirectUri_example", // String | 
  'grantType': "grantType_example" // String | 
};
apiInstance.token(apiVersion, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
apiVersion String API Version Header
code String [optional]
clientId String [optional]
clientSecret String [optional]
redirectUri String [optional]
grantType String [optional]

Return type

TokenResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json, /