unsplash v0.3.0 Unsplash.OAuth

Authorization

Unsplash.OAuth.authorize_url! scope: "public read_user write_user read_photos write_photos write_likes" Unsplash.OAuth.authorize!(code: auth_code_from_the_callback_above)

Now all calls will be authorized.

Summary

Functions

authorize!(params \\ [], headers \\ [], options \\ [])
authorize_url(client, params)
authorize_url!(params \\ [])

Generates the authorization url which then authenticates with the user.

The scope option should be space seperated string of requested scopes.

Possible scopes:

  • public All public actions (default)
  • read_user Access user’s private data.
  • write_user Update the user’s profile.
  • read_photos Read private data from the user’s photos.
  • write_photos Upload photos on the user’s behalf.
  • write_likes Like photos on a the user`s behalf.

Examples

iex> url = Unsplash.OAuth.authorize_url! scope: “public read_user write_user read_photos write_photos write_likes” iex> is_binary(url) true

get_access_token()
get_token(client, params, headers)
process_token(token)
remove_token()
start()
store_token(token)
un_authorize!()