Requirements
You will need to have requested the creation of a new OAuth Client by WireMock Cloud. You will need to tell us:- The maximum time you allow between interactions before the user has to reauthenticate
- The maximum total time you allow between authentications, eve if the user is regularly interacting
Inputs
{client_id}
: The OAuth client (in Auth0, the Application id) provided by WireMock Cloud valid
Initiate the Client
request
discover_urls
Initiate the Device Authorization Flow
request
device_authorization
expires_in
and interval
are values in seconds.
Pass control to the user to authenticate
Something like this should be rendered:{device_authorization.verification_uri_complete}
should be opened automatically in
the user’s browser.
Poll for successful authentication
Every{device_authorization.interval}
seconds until {device_authorization.expires_in}
seconds have passed you poll
as so:
request
response
{device_authorization.interval}
unless
{device_authorization.expires_in}
has passed”
or
token_response
response
Authorization: {token_response.token_type} {token_response.access_token}
Refresh Tokens
WireMock access tokens are JWTs, and cannot be revoked. Consequently they are short-lived (sub 10 minutes). In order to avoid having to authenticate regularly, the client may exchange a refresh token (which can be revoked) for a new access token. A refresh token, once used, becomes invalid - a new one is returned along with the new access token. Any attempt to use an invalid refresh token will also invalidate the current valid refresh token, forcing a reauthentication. Refresh tokens can be explicitly revoked on logout.Exchanging a refresh token for a new access token
request
token_response
Invalidating a refresh token
request