Using a Token

Once you have obtained a token you can use it to authenticate to a to a Spectrumâ„¢ Technology Platform web service by including the token in the request. There are two ways of doing this: as an Authorization HTTP header or as a Cookie HTTP header.

Note: There is no limit to the number of web service requests you can make with a token, but if you requested a token with an expiration, the token will eventually expire. If the token is a session token, it will become invalid after 30 minutes of inactivity.

Using the Token in an Authorization Header

To use the token in the HTTP Authorization header, use the format:

Authorization: Bearer Token

For example,

HTTP/1.1

POST http://MySpectrumServer:8080/soap/ValidateAddress
Host: MySpectrumServer:8080
Authorization: Bearer eyJlbmMiBMQI4Q0JDLUhTMjU2I5wiYWxnIjoiZGlyIn0..fc6rpRJ-wo

If the token is a session token, you must also provide the session identifier in the Cookie header in the form:

Cookie: SESSION=SessionID

For example,

HTTP/1.1

POST http://MySpectrumServer:8080/soap/ValidateAddress
Host: MySpectrumServer:8080
Authorization: Bearer eyJlbmMiBMQI4Q0JDLUhTMjU2I5wiYWxnIjoiZGlyIn0..fc6rpRJ-wo
Cookie: SESSION=fff96e54-1615-4192-96c1-ea2f133ec6eb
Note: The cookie name SESSION must be in all caps.

Using the Token in a Cookie Header

If it is easier to use a cookie rather than the Authorization header you can provide the token in the Cookie header in the form:

Cookie: spectrum.authentication.token=Token

For example,

HTTP/1.1

POST http://MySpectrumServer:8080/soap/ValidateAddress
Host: MySpectrumServer:8080
Cookie: spectrum.authentication.token=eyJlbmMiBMQI4Q0JDLUhTMjU2I5wiYWxnIjoiZGlyIn0..fc6rpRJ-wo

If the token is a session token, you must also provide the session identifier in the Cookie header in the form:

Cookie: SESSION=SessionID
Note: The cookie name SESSION must be in all caps.

For example,

HTTP/1.1

POST http://MySpectrumServer:8080/soap/ValidateAddress
Host: MySpectrumServer:8080
Cookie: spectrum.authentication.token=eyJlbmMiBMQI4Q0JDLUhTMjU2I5wiYWxnIjoiZGlyIn0..fc6rpRJ-wo
Cookie: SESSION=fff96e54-1615-4192-96c1-ea2f133ec6eb