Construct a client with its client credentials.
Send an HTTPS request for temporary credentials with a callback URL which the server will call with an OAuth verification code after authorizing the resource owner (end-user).
Obtain temporary credentials from a successful server response.
Use the temporary credentials to build an authorization URL and redirect the resource owner (end-user) to the generated URL.
If a callback URL is not provided when requesting temporary credentials, the server displays the OAuth verification code to the resource owner (end-user), which she then types into your application.
OR
If a callback URL is provided, the server redirects the resource owner (end-user) after authorization to your callback URL attaching the OAuth verification code as a query parameter.
Using the obtained OAuth verification code from step 5 and the temporary credentials obtained in step 3, send an HTTPS request for token credentials.
Obtain token credentials from a successful server response.
Save the token credentials for future use (say, in a database).