ABBYY Cloud OCR SDK service requires authentication before allowing access to its API. To have your client program authenticated with the service, you need a registered Application ID and Application Password. You can find the Application ID and Application Password in the e-mail message sent to you on application creation. To get started and create an application, please follow this link to register.
The service uses Basic access authentication for the API calls. The client program should include an authorization header field with each HTTP request it sends to the service: "Authorization: Basic <ApplicationID:ApplicationPassword>". The authorization header contains the authentication scheme (Basic) and the appropriate Application ID and Application Password separated with a colon and Base64-encoded. The service processes the request only if it is sent with a properly formed authorization header that includes a valid Application ID and Application Password.
Note: In contrast, the GET request to download the result (using the URL returned by the getTaskStatus method) should not include any authorization headers. Using your Cloud OCR SDK authorization headers will result in an error.
Different programming languages or development environments can require different steps to add a correct authorization header. Consult our Code Samples for the programming language you use. In case of doubt please use a HTTP debugger such as Fiddler to check that the HTTP request sent to the service by your program actually contains a properly formed authentication header.
The communication security can be provided via Secure Sockets Layer (SSL). The client can request a secure connection from the server, check the trusted certificate authority returned by the server and, if the certificate is valid, begin the secured connection. Using SSL is optional.
C# sample
// Create a Web request using location-based URL and // setup it with the correct Application ID and Application Password String url = "http://<PROCESSING_LOCATION_ID>.ocrsdk.com/processImage?Language=English,Russian"; WebRequest request = WebRequest.Create( url ); Encoding encoding = Encoding.GetEncoding("iso-8859-1"); string toEncode = ApplicationID + ":" + ApplicationPassword; string baseEncoded = Convert.ToBase64String(encoding.GetBytes(toEncode)); request.Headers.Add( "Authorization", "Basic " + baseEncoded ); //The request now has authentication header set up correctly
Comments
0 comments
Please sign in to leave a comment.