Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Files

Latest commit

 

History

History
62 lines (43 loc) · 2.63 KB

MobileAuthorizationApi.md

File metadata and controls

62 lines (43 loc) · 2.63 KB

MobileAuthorizationApi

All URIs are relative to https://connect.squareup.com

Method HTTP request Description
createMobileAuthorizationCode POST /mobile/authorization-code CreateMobileAuthorizationCode

createMobileAuthorizationCode

CreateMobileAuthorizationCodeResponse createMobileAuthorizationCode(body)

CreateMobileAuthorizationCode

Generates code to authorize a mobile application to connect to a Square card reader Authorization codes are one-time-use and expire 60 minutes after being issued. Important: The `Authorization` header you provide to this endpoint must have the following format: ``` Authorization: Bearer ACCESS_TOKEN ``` Replace `ACCESS_TOKEN` with a valid production authorization credential.

Example

// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.MobileAuthorizationApi;

ApiClient defaultClient = Configuration.getDefaultApiClient();

// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");

MobileAuthorizationApi apiInstance = new MobileAuthorizationApi();
CreateMobileAuthorizationCodeRequest body = new CreateMobileAuthorizationCodeRequest(); // CreateMobileAuthorizationCodeRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.
try {
    CreateMobileAuthorizationCodeResponse result = apiInstance.createMobileAuthorizationCode(body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling MobileAuthorizationApi#createMobileAuthorizationCode");
    e.printStackTrace();
}

Parameters

Name Type Description Notes
body CreateMobileAuthorizationCodeRequest An object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

CreateMobileAuthorizationCodeResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json