Deep Link

Client Credentials Token

The client can request an access token using only its client credentials (or other supported means of authentication) when the client is requesting access to the protected resources under its control, or those of another resource owner that have been previously arranged with the authorization server (the method of which is beyond the scope of this specification). To make this token request, send a HTTP POST request below.

                
$client = new http\Client;
$request = new http\Client\Request;

$request->setRequestUrl('https://z-wallet.monpay.mn/v2/oauth/token?client_id={ClientID provided by Mobifinance}&client_secret={ClientSecret provided by Mobifinance}&grant_type={client_credentials}');
$request->setRequestMethod('POST');

$body = new http\Message\Body;
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
  'Content-Type' => 'application/x-www-form-urlencoded'
));

$client->enqueue($request)->send();

$response = $client->getResponse();
echo $response->getBody();
                
            
                
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");

RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://z-wallet.monpay.mn/v2/oauth/token?client_id={ClientID provided by Mobifinance}&client_secret={ClientSecret provided by Mobifinance}&grant_type={client_credentials}")
  .method("POST", body)
  .addHeader("Content-Type", "application/x-www-form-urlencoded")
  .build();

Response response = client.newCall(request).execute();
                
            
Method POST
URL https://z-wallet.monpay.mn/v2/oauth/token
Content-Type application/x-www-form-urlencoded
Request
Parameters Type Required Description
client_id string Yes Client ID provided by Mobifinance
client_secret string Yes Client secret provided by Mobifinance
grant_type string Yes As defined in the OAuth 2.0 specification, this field must contain a value of client_credentials.
Response
Parameters Type Description
access_token string The token that can be send to API. Next step APIs will be called using this token.
token_type string Token type. (Bearer) (Bearer)
Response type
Code Message Description
400 invalid_request Bad request
401 unauthorized_client Invalid client_id or client_secret
403 invalid_grant Invalid code
415 unsupported_grant_type Unsupported type
505 server_error Internal server error