Server Authentication - MATLAB & Simulink (original) (raw)
Main Content
MATLAB® provides programmatic interfaces to these Web service interfaces.
- RESTful (Representational state transfer)—Use the webread, webwrite, and websave functions in Web Services to read content from RESTful Web services.
- HTTP (Hypertext Transfer Protocol)—Use the Call Web Services from MATLAB Using HTTP API to implement advanced HTTP messaging semantics.
To use a proxy server, see Proxy Server Authentication.
Server Authentication for RESTful Web Services
Kerberos is not supported on Linux® and macOS platforms.
Authentication | Platform | weboptions | weboptions Arguments | System Setup |
---|---|---|---|---|
Basic | Windows®Linux macOS | Required | Username andPassword | N/A |
Digest | WindowsLinux macOS | Required | Username andPassword | N/A |
NTLM | Windows | Optional | Do not specify Username orPassword | Logged into Windows domain |
NTLM | Linux macOS | Required | Username andPassword | N/A |
KerberosNegotiate (SPNEGO) | Windows | Optional | Do not specify Username orPassword | Logged into Kerberos domain |
Server Authentication for HTTP Web Services
Kerberos is not supported on Linux and macOS platforms.
Create Header Fields for OAuth
Authentication
The matlab.net.http.AuthenticationScheme class does not support theOAuth
authentication scheme. However, you can create the specific header fields required by OAuth
. For an example, seeAccessing Twitter with HTTP Interface in MATLAB.
Add Bearer Token to Header Fields
MATLAB does not support Bearer schemes using a Credentials
object. However, if you have a Bearer token, you can add the token to the header field of the request.
For example, to use <user's_token>
in a RESTful Web Services function, type:
token = '<user's_token>'; opts = weboptions; opts.HeaderFields = {'Authorization', ['Bearer ', token]}; resp = webread(url, opts);
To use <user's_token>
in a HTTP Web Services function, type:
token = '<user's_token>'; hf = HeaderField('Authorization', ['Bearer ', token]); req = RequestMessage('GET', hf); resp = req.send(uri);
See Also
matlab.net.http.AuthenticationScheme | matlab.net.http.HTTPOptions | matlab.net.http.Credentials