spring oauth2 authorization code flow , configuration for VK (Vkontakte)

喜欢而已 提交于 2019-12-04 12:19:41

Actually after couple days of investigation i figured out that Spring OAuth2 completely implementing all features and configuration to my client application uses the authorization code grant to obtain an access token from Vkontakte (the Authorization Server)

The only thing i need to do if i take as sample Spring Boot and OAuth2 social login simple is to populate application.yml with correct creds for my Authorization server:

security:
  oauth2:
    client:
      clientId: xxxxxxx
      clientSecret: xxxxxxxxxxx
      accessTokenUri: https://oauth.vk.com/access_token
      userAuthorizationUri: https://oauth.vk.com/authorize
      tokenName: code
      authenticationScheme: query
      clientAuthenticationScheme: form
      grant-type: authorization_code
    resource:
      userInfoUri: https://api.vk.com/method/users.get

The only problem i faced was providing correct token name and userInfoUri to retrieve logged user info.

According token name it is name of authorization code your get after passing authoriztion(response_type=token name, it calls code in my case) and use to get access token.

Hope it will be helpful people face the same problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!