Problem/Motivation
If you have not entered the in unsplash credentials in intermediate field settings and you start adding media items then you will get this error:
The website encountered an unexpected error. Try again later.
Unsplash\Exception: ["OAuth error: The access token is invalid"] in Unsplash\Endpoint::__callStatic() (line 98 of /var/www/html/vendor/unsplash/unsplash/src/Endpoint.php).
Unsplash\Photo::find('9SL_aTkpWaI') (Line: 61)
Drupal\media_entity_unsplash\UnsplashFetcher->fetchImage('9SL_aTkpWaI') (Line: 179)
Drupal\media_entity_unsplash\Plugin\media\Source\Unsplash->fetchImageT('9SL_aTkpWaI') (Line: 194)
Drupal\media_entity_unsplash\Plugin\media\Source\Unsplash->getMetadata(Object, 'thumbnail_uri') (Line: 266)
Drupal\media\Entity\Media->getThumbnailUri() (Line: 162)
Drupal\media\Entity\Media->updateThumbnail() (Line: 449)
Drupal\media\Entity\Media->prepareSave() (Line: 27)
Drupal\media\MediaStorage->save(Object) (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 293)
Drupal\Core\Entity\EntityForm->save(Array, Object) (Line: 61)
Drupal\media\MediaForm->save(Array, Object)
Documentation is not clear enough about selling credentials before doing anything.
Steps to reproduce
Enable to module. Add a media item.
Proposed resolution
Make some documentation changes suits more explicit did you need to enter the credentials? Also explain where to find the credentials.
Improve the error message.
Remaining tasks
Everything
User interface changes
Improved error message
API changes
Data model changes
Issue fork media_entity_unsplash-3532906
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
batigolixComment #7
batigolixComment #10
fabianderijkThanks! I've merged the merge request