rajithd / spring-boot-oauth2

Spring Boot Oauth2 with H2 database
208 stars 166 forks source link

o.s.s.o.p.token.store.JdbcTokenStore: Fail to find access token for token ... #2

Open chao10 opened 8 years ago

chao10 commented 8 years ago

Hello,

I was trying out the rest api calls to /api/secure and /oauth/logout, but met the following error (error log appended below). Any clues as why this happening, and how to fix this?

Thanks.

2015-12-19 15:05:31.848 INFO 7710 --- [nio-9191-exec-1] o.s.s.o.p.token.store.JdbcTokenStore : Failed to find access token for token 91660e2a-63e0-4da7-8b24-0eecbc651d6d Hibernate: select user0_.username as username11, user0_.activated as activate21, user0_.activationkey as activati31, user0_.email as email41, user0_.password as password51, user0_.resetpasswordkey as resetpas61 from user user0 where lower(user0.username)=lower(?) Hibernate: select authoritie0_.username as username1_10, authoritie0_.authority as authorit2_20, authority1_.name as name1_01 from userauthority authoritie0 inner join authority authority1 on authoritie0.authority=authority1.name where authoritie0.username=?

rajithd commented 8 years ago

Could you please give me some more info. Curl commands that you try out ?

chao10 commented 8 years ago

Yes, I was using curl to access the logout api, like below:

curl -i http://localhost:9191/api/oauth/logout -H "Authorization: Bearer d175c4b6-6e11-4b4f-9300-8eddf280d542"

I did some debugging, and I think it is because the first letter of the HEADER_AUTHORIZATION constant was not capitalized. It really should be "Authorization".

Thanks for all the good work, which helps me a lot. It might be also interesting to know how the user registration works. :+1:

trubbio83 commented 8 years ago

OAuth2AccessToken oAuth2AccessToken = tokenStore.readAccessToken(token.split(" ")[0]); should be token.split(" ")[1]