This PHP script helps you to get OAuth2 refresh token from console for your Yahoo API app (server-side installed application flow), e.g. for Yahoo Gemini or Yahoo Social APIs apps.
The access token expires but the refresh token doesn't, and should be stored for later use. Using the refresh token you can get a new access token.
See Explicit Grant Flow in Yahoo OAuth 2.0 Guide.