{"action":"created","issue":{"url":"https://api.github.com/repos/codenameone/CodenameOne/issues/1479","labels_url":"https://api.github.com/repos/codenameone/CodenameOne/issues/1479/labels{/name}","comments_url":"https://api.github.com/repos/codenameone/CodenameOne/issues/1479/comments","events_url":"https://api.github.com/repos/codenameone/CodenameOne/issues/1479/events","html_url":"https://github.com/codenameone/CodenameOne/issues/1479","id":72727001,"number":1479,"title":"OAuth2 result access token processing causes StringIndexOutOfBoundsException","user":{"login":"igo211","id":11697822,"avatar_url":"https://avatars.githubusercontent.com/u/11697822?v=3","gravatar_id":"","url":"https://api.github.com/users/igo211","html_url":"https://github.com/igo211","followers_url":"https://api.github.com/users/igo211/followers","following_url":"https://api.github.com/users/igo211/following{/other_user}","gists_url":"https://api.github.com/users/igo211/gists{/gist_id}","starred_url":"https://api.github.com/users/igo211/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igo211/subscriptions","organizations_url":"https://api.github.com/users/igo211/orgs","repos_url":"https://api.github.com/users/igo211/repos","events_url":"https://api.github.com/users/igo211/events{/privacy}","received_events_url":"https://api.github.com/users/igo211/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"chen-fishbein","id":1298420,"avatar_url":"https://avatars.githubusercontent.com/u/1298420?v=3","gravatar_id":"","url":"https://api.github.com/users/chen-fishbein","html_url":"https://github.com/chen-fishbein","followers_url":"https://api.github.com/users/chen-fishbein/followers","following_url":"https://api.github.com/users/chen-fishbein/following{/other_user}","gists_url":"https://api.github.com/users/chen-fishbein/gists{/gist_id}","starred_url":"https://api.github.com/users/chen-fishbein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chen-fishbein/subscriptions","organizations_url":"https://api.github.com/users/chen-fishbein/orgs","repos_url":"https://api.github.com/users/chen-fishbein/repos","events_url":"https://api.github.com/users/chen-fishbein/events{/privacy}","received_events_url":"https://api.github.com/users/chen-fishbein/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-05-03T01:15:30Z","updated_at":"2015-05-07T20:01:38Z","closed_at":"2015-05-07T20:01:38Z","body":"When using the Oauth2 class to authenticate against an Oauth2 service provider (such as Instagram), a StringIndexOutOfBoundsException will happen if the Oauth2 service provider does not pass back any additional arguments in beyond the access token provided in the resulting redirect URL.\r\n\r\nThe problem is line 327 in the Oauth2 class:\r\ntoken = accessToken.substring(accessToken.indexOf(\"=\") + 1, accessToken.indexOf(\"&\"));\r\n\r\nSpecifically, the \"accessToken.indexOf(\"&\")\" part means there's an assumption that the redirect URL will always contain at least 1 additional arg beyond the access token - which is not true in the case of Instagram, and likely other Oauth2 providers as well."},"comment":{"url":"https://api.github.com/repos/codenameone/CodenameOne/issues/comments/99998005","html_url":"https://github.com/codenameone/CodenameOne/issues/1479#issuecomment-99998005","issue_url":"https://api.github.com/repos/codenameone/CodenameOne/issues/1479","id":99998005,"user":{"login":"chen-fishbein","id":1298420,"avatar_url":"https://avatars.githubusercontent.com/u/1298420?v=3","gravatar_id":"","url":"https://api.github.com/users/chen-fishbein","html_url":"https://github.com/chen-fishbein","followers_url":"https://api.github.com/users/chen-fishbein/followers","following_url":"https://api.github.com/users/chen-fishbein/following{/other_user}","gists_url":"https://api.github.com/users/chen-fishbein/gists{/gist_id}","starred_url":"https://api.github.com/users/chen-fishbein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chen-fishbein/subscriptions","organizations_url":"https://api.github.com/users/chen-fishbein/orgs","repos_url":"https://api.github.com/users/chen-fishbein/repos","events_url":"https://api.github.com/users/chen-fishbein/events{/privacy}","received_events_url":"https://api.github.com/users/chen-fishbein/received_events","type":"User","site_admin":false},"created_at":"2015-05-07T20:01:38Z","updated_at":"2015-05-07T20:01:38Z","body":"fixed, thanks"}}