User Authentication

Many of Flickr’s API methods require the user to be signed in. In the past we were using our own authentication API, but now, users should only be authenticated using the OAuth specification which is the industry standard. By using the OAuth standard you will provide in your applications a secure way for people to sign-in into their Flickr accounts with all the different account types Flickr is supporting (Yahoo! ID, Google ID, Facebook). Flickr’s OAuth flows work for web-applications, desktop apps and mobile applications as well.

The old Authentication API is still available, but has been deprecated.

Using OAuth with Flickr

What is OAuth?

OAuth is an open, simple, and secure protocol that enables applications to authenticate users and interact with Flickr on their behalf. The end user's information is securely transferred without revealing the identity of the user. At Flickr, we use OAuth to verify that an application trying to interact with Flickr on your behalf is doing so only with the permissions you have granted it.

This document supplements the OAuth Core 1.0 Revision A specification and explains how the authorization process works with Flickr.

The simplest way to get started with OAuth is to use a library with your programming language. To find a library for your programming language, visit the OAuth Code page.

We also have a transition process in place for existing applications, using the old Auhentication API, to migrate to OAuth.

The OAuth flow has 3 steps:

  1. Get a Request Token
  2. Get the User's Authorization
  3. Exchange the Request Token for an Access Token
Flickr OAuth Authorization Flow

Flickr OAuth Authorization Flow

Signing Requests

You must sign all requests to the Flickr API. Currently, Flickr only supports HMAC-SHA1 signature encryption.

First, you must create a base string from your request. The base string is constructed by concatenating the HTTP verb, the request URL, and all request parameters sorted by name, using lexicograhpical byte value ordering, separated by an '&'.

Use the base string as the text and the key is the concatenated values of the Consumer Secret and Token Secret, separated by an '&'.

For example, using the following URL:

Would have a base string that looks like the following:


Which would generate the following signature:


Getting a Request Token

Request Token URL:

The first step to obtaining authorization for a user is to get a Request Token using your Consumer Key. This is a temporary token that will be used to authenticate the user to your application. This token, along with a token secret, will later be exchanged for an Access Token.

The following is an example URL request for a request token:

Flickr returns a response similar to the following:


Getting the User Authorization

User Authorization URL:

After getting the Request Token, your application needs to present the Flickr authorization page to the user, where they will be asked to give permission to your application to access their data. The authorization page will present the user with a list of permissions your application is requesting, as defined in the authentication flow settings.

Additionally, you can pass the optional perms= parameter, asking for read, write, or delete privileges. This parameter will override the setting defined in your application's authentication flow.

After authorization is complete, Flickr will redirect the user back to your application using the oauth_callback specified with your Request Token.

The following is an example authorization URL:

The following is an example callback after authorization:

Exchanging the Request Token for an Access Token

Access Token URL:

After the user authorizes your application, you can exchange the approved Request Token for an Access Token. This Access Token should be stored by your application, and used to make authorized requests to Flickr.

The following is an example of a request for an Access Token:

Flickr returns a response similar to the following:


Calling the Flickr API with OAuth

After an Access Token has been granted to your application, you can make authenticated requests to the Flickr API. Flickr requires HMAC-SHA1 encryption because all requests are being made insecurely using HTTP.

The following is an example of a request made to the flickr.test.login API:
?nojsoncallback=1 &oauth_nonce=84354935

Flickr returns a response similar to the following:

{"user":{"id":"21207597@N07", "username":{"_content":"jamalfanaian"}}, "stat":"ok"}

Transition from the old Authentication API

You can exchange an old auth token from the old Authentication API, to an OAuth access token token. The process simply requires that you make an authenticated request to the flickr.auth.oauth.getAccessToken API, which will exchange the old token used to make the request, with a new OAuth access token.

Please note, that the old auth token will be deleted 24 hours after calling this API method.