unsplash v1.0.0 Unsplash.Utils.OAuth View Source

Authorization

Unsplash.OAuth.authorize_url! scope: "public read_user write_user read_photos write_photos write_likes read_collections write_collections"Unsplash.OAuth.authorize!(code: auth_code_from_the_callback_above)` Now all calls will be authorized.

Link to this section Summary

Link to this section Functions

Link to this function authorize!(params \\ [], headers \\ [], options \\ []) View Source
Link to this function authorize_url(client, params) View Source
Link to this function authorize_url!(params \\ []) View Source

Generates the authorization url which then authenticates with the user.

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

Possible scopes:

  • public Default. Read public data.
  • 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 or unlike a photo on the user’s behalf
  • read_collections View a user’s private collections.
  • write_collections Create and update a user’s collections.

Examples

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

Link to this function get_token(client, params, headers) View Source