Revoke a token
--------------

Endpoint:

	https://auth.datasetu.org/auth/v1/token/revoke

Description:

	This API is used to revoke a valid access token.

Called by:

	A "data provider" or a "data consumer" with a valid class-3 or above certificate.

Methods:

	POST

Headers:

	content-type : "application/json"

Body in JSON format:

	{
		"tokens"	: <array of tokens to be revoked>	(to be sent by a data consumer)		// required 
		"token-hashes"	: <array of token-hashes to be revoked>	(to be sent by a data provider)		// required 
	}

	Note: Either of "tokens" or "token-hashes" must be provided; not both.

	Note: Data providers can get the "token-hashes" using the "audit/tokens" API.

HTTP response codes:

	200
		If token has been successfully revoked.

	403
		If token is invalid.

	429
		If the user makes too many requests.

Using pyIUDX SDK:

	from pyIUDX.auth import auth

	# as a data consumer
	iudx_auth		= auth.Auth("consumer-certificate.pem","private-key.pem")
	tokens_to_revoke	= ["auth.datasetu.org/2204adcbc990ffff234689aaabcdef90"]

	iudx_auth.revoke_tokens(tokens_to_revoke)

	# as a data provider
	iudx_auth		= auth.Auth("provider-certificate.pem","private-key.pem")
	token_hashes_to_revoke	= ["6d025974c916cadf8f683a99c65ebce871913118"]

	iudx_auth.revoke_token_hashes(token_hashes_to_revoke)

CURL example:

	Request:

		curl -XPOST https://auth.datasetu.org/auth/v1/token/revoke

		--cert certificate.pem --key private-key.pem

		-H 'content-type: application/json'

		-d '{"tokens" : ["auth.datasetu.org/2204adcbc990ffff234689aaabcdef90"]}


	Response:

		200 OK
		content-type : "application/json"

		{
			"num-tokens-revoked" : 1
		}

See also:

	audit tokens API:
		http://auth.datasetu.org/audit-tokens.html

	token revoke all API:
		http://auth.datasetu.org/token-revoke-all.html