Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.74 KB

mobile-authorization.md

File metadata and controls

58 lines (39 loc) · 1.74 KB

Mobile Authorization

MobileAuthorizationApi mobileAuthorizationApi = client.getMobileAuthorizationApi();

Class Name

MobileAuthorizationApi

Create Mobile Authorization Code

Generates code to authorize a mobile application to connect to a Square card reader.

Authorization codes are one-time-use codes 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.

CompletableFuture<CreateMobileAuthorizationCodeResponse> createMobileAuthorizationCodeAsync(
    final CreateMobileAuthorizationCodeRequest body)

Parameters

Parameter Type Tags Description
body CreateMobileAuthorizationCodeRequest Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

CreateMobileAuthorizationCodeResponse

Example Usage

CreateMobileAuthorizationCodeRequest body = new CreateMobileAuthorizationCodeRequest.Builder()
    .locationId("YOUR_LOCATION_ID")
    .build();

mobileAuthorizationApi.createMobileAuthorizationCodeAsync(body).thenAccept(result -> {
    // TODO success callback handler
    System.out.println(result);
}).exceptionally(exception -> {
    // TODO failure callback handler
    exception.printStackTrace();
    return null;
});