diadal / universal-social-auth

SPA universal social auth
MIT License
40 stars 11 forks source link

Twitter does not seem to be working #21

Open whoacowboy opened 1 year ago

whoacowboy commented 1 year ago

Describe the bug I am unable to log in using Twitter, but the same configuration allows me to log in with Facebook, Google, Discord, Twitch and others.

I get the error message "There is no request token for this page."

ss

config

const options = {
    providers: {
      twitter: {
        url: process.env.TWITTER_URL,
        clientId: process.env.TWITTER_ID,
        redirectUri: process.env.TWITTER_REDIRECT_URI,
      },
    },
  }
  const Oauth = new UniversalSocialauth(axios, options)
  app.config.globalProperties.$Oauth = Oauth
  app.provide('$Oauth', Oauth)

component

import { inject } from 'vue'
import { useStore } from 'vuex'
import { Github, Facebook, Google, Twitter } from 'universal-social-auth'

const Oauth = inject('$Oauth')
const store = useStore()

function useAuthProvider(provider, proData) {
  const pro = proData
  const ProData = pro || Providers[provider]
  Oauth.authenticate(provider, ProData).then((response) => {
    if (response.code) {
      responseData.value.code = response.code
      responseData.value.provider = provider
      store.dispatch('auth/socialLogin', { provider, response })
    }
  }).catch((err) => {})
}

call

@click="useAuthProvider('twitter', Twitter)"