danshannon / javastravav3api

Strava API v3 implementation written in Java v8
http://danshannon.github.io/javastravav3api/
81 stars 44 forks source link

#194 Fix token storage issue for no email on athlete #193

Open vandeseer opened 5 years ago

vandeseer commented 5 years ago

According to https://developers.strava.com/docs/oauth-updates/ there was an update such that the email address is no longer in the oauth answer:

January 15, 2019 Email address is no longer part of the profile:read_all scope and is removed from the athlete model.

Hence one gets this error:

Exception in thread "main" java.lang.IllegalArgumentException: Cannot store a token if the athlete has no email
    at javastrava.auth.TokenManager.storeToken(TokenManager.java:220)
    at javastrava.auth.impl.AuthorisationServiceImpl.tokenExchange(AuthorisationServiceImpl.java:41)

My change fixes this by replacing the user email as map key by the athlete/user ID.