I’m trying to authenticate users with spring security according to the following configuration:

spring:
  security:
    oauth2:
      client:
        registration:
          twitter:
            client-id: ${TWITTER_OAUTH_CLIENT_ID}
            client-secret: ${TWITTER_OAUTH_CLIENT_SECRET}
            authorization-grant-type: authorization_code
            redirect-uri: ${BASE_URL}/login/oauth2/code/twitter
            scope:
            - tweet.read
        provider:
          twitter:
            authorization-uri: https://twitter.com/i/oauth2/authorize
            token-uri: https://api.twitter.com/2/oauth2/token

The ${TWITTER_OAUTH_CLIENT_ID}, ${TWITTER_OAUTH_CLIENT_SECRET}, and ${BASE_URL} are all set as environment variables, don’t seem to be having issues with those.

When I click the login button I’m taken to twitter’s login page and I authenticate just fine but afterwards I’m taken to a page with the message:

You weren’t able to give access to the App. Go back and try logging in again.

Anyone know what I am doing incorrectly?

Hi welcome to the community
Try recheck whitelist callback url in the developer portal settings or CLIENT_ID
The error usually occurs because of these two problems.
Also check this topic

Where is that whitelist option? Not seeing any issues with Client ID.

It’s in your developer portal, in the app settings section, click edit on User authentication settings

I have the exact URL being used in the application as the redirect_uri in the list

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.