Utilisation d'un jeton
Une fois que vous avez obtenu un jeton, vous pouvez l'utiliser pour vous authentifier auprès d'un service Web Spectrum™ Technology Platform en incluant le jeton dans la requête. Il existe deux façons d'effectuer cette opération : sous forme d'en-tête HTTP Authorization ou sous forme d'en-tête HTTP Cookie.
Utilisation du jeton dans un en-tête Authorization
Pour utiliser l'en-tête Authorization HTTP , utilisez le format suivant :
Authorization: Bearer Token
Par exemple,
HTTP/1.1
POST http://MySpectrumServer:8080/soap/ValidateAddress
Host: MySpectrumServer:8080
Authorization: Bearer eyJlbmMiBMQI4Q0JDLUhTMjU2I5wiYWxnIjoiZGlyIn0..fc6rpRJ-wo
Si le jeton est un jeton de session, vous devez également fournir l'identifiant de session dans l'en-tête Cookie au format suivant :
Cookie: SESSION=SessionID
Par exemple,
HTTP/1.1
POST http://MySpectrumServer:8080/soap/ValidateAddress
Host: MySpectrumServer:8080
Authorization: Bearer eyJlbmMiBMQI4Q0JDLUhTMjU2I5wiYWxnIjoiZGlyIn0..fc6rpRJ-wo
Cookie: SESSION=fff96e54-1615-4192-96c1-ea2f133ec6eb
Utilisation du jeton dans un en-tête Cookie
S'il est plus facile d'utiliser un cookie plutôt qu'un en-tête Authorization , vous pouvez fournir le jeton dans l'en-tête Cookie au format suivant :
Cookie: spectrum.authentication.token=Token
Par exemple,
HTTP/1.1
POST http://MySpectrumServer:8080/soap/ValidateAddress
Host: MySpectrumServer:8080
Cookie: spectrum.authentication.token=eyJlbmMiBMQI4Q0JDLUhTMjU2I5wiYWxnIjoiZGlyIn0..fc6rpRJ-wo
Si le jeton est un jeton de session, vous devez également fournir l'identifiant de session dans l'en-tête Cookie au format suivant :
Cookie: SESSION=SessionID
Par exemple,
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