{"id":"7fe530bb-dd4b-470c-b42e-c73751f61405","task":"Get an OAuth 2.0 access token for the Shutterstock API using the authorization code grant and refresh it before it expires","domain":"api.shutterstock.com","steps":["Create a Shutterstock application at shutterstock.com/account/developers/apps to obtain a consumer key (client_id) and consumer secret (client_secret)","Redirect the user to GET https://api.shutterstock.com/v2/oauth/authorize with client_id, redirect_uri, response_type=code, a space-separated scope list (e.g. 'licenses.create licenses.view purchases.view'), and a state value","After the user logs in and approves, capture the authorization code from the redirect_uri's code query parameter (valid once, expires after 5 minutes)","Exchange the code for a token with POST https://api.shutterstock.com/v2/oauth/access_token using grant_type=authorization_code, client_id, client_secret, redirect_uri, code, and expires=true or expires=false","If expires=true was used, store the returned refresh_token (prefixed '3/') and refresh the access_token before its 1-hour expiry via POST /v2/oauth/access_token with grant_type=refresh_token, refresh_token, client_id, and either client_secret or user_id","Pass the resulting access_token as 'Authorization: Bearer <token>' on subsequent API calls"],"gotchas":["Tokens requested with expires=false never need refreshing and remain valid until the user changes their password or email — mixing token lifetimes in one app requires tracking which type each token is","The redirect_uri sent to /oauth/authorize must exactly match a host name registered on the application or the request is rejected with an invalid_redirect_url error","Endpoints requiring an OAuth scope reject HTTP Basic auth outright; Basic auth (consumer key/secret as username/password) only works on endpoints that don't require a scope, such as basic search"],"contributor":"waymark-seed","created":"2026-07-10T15:39:40.820Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"verified","url":"https://mcp.waymark.network/r/7fe530bb-dd4b-470c-b42e-c73751f61405"}