reactjs-social-login icon indicating copy to clipboard operation
reactjs-social-login copied to clipboard

Getting Error : http://localhost:3000/?error=unauthorized_scope_error&error_description=Scope+%26quot%3Br_liteprofile%26quot%3B+is+not+authorized+for+your+application&state=_linkedin

Open Rohini1206 opened this issue 1 year ago • 3 comments

`import React, { useCallback, useState } from 'react' import './App.css'

import {

IResolveParams,

LoginSocialLinkedin,

} from 'reactjs-social-login'

// CUSTOMIZE ANY UI BUTTON import {

LinkedInLoginButton,

} from 'react-social-login-buttons' import { User } from './User';

// REDIRECT URL must be same with URL where the (reactjs-social-login) components is locate // MAKE SURE the (reactjs-social-login) components aren't unmounted or destroyed before the ask permission dialog closes const REDIRECT_URI = window.location.href;

const App = () => { const [provider, setProvider] = useState('') const [profile, setProfile] = useState()

const onLoginStart = useCallback(() => { alert('login start') }, [])

const onLogoutSuccess = useCallback(() => { setProfile(null) setProvider('') alert('logout success') }, [])

return ( <> {/* {provider && profile ? ( <User provider={provider} profile={profile} onLogout={onLogoutSuccess} /> ) : ( */} <div className={App ${provider && profile ? 'hide' : ''}}> <h1 className='title'>ReactJS Social Login

      <LoginSocialLinkedin
        isOnlyGetToken
        client_id={'clientId' || ''}
        client_secret={'clientSecret' || ''}
        redirect_uri={'http://localhost:3000'}
        onLoginStart={onLoginStart}
        onResolve={({ provider, data }: IResolveParams) => {
          setProvider(provider)
          setProfile(data)
        }}
        onReject={(err: any) => {
          console.log(err)
        }}
      >
        <LinkedInLoginButton />
      </LoginSocialLinkedin>

    </div>
  {/* )} */}
</>

) }

export default App`

http://localhost:3000/?error=unauthorized_scope_error&error_description=Scope+%26quot%3Br_liteprofile%26quot%3B+is+not+authorized+for+your+application&state=_linkedin

image

Rohini1206 avatar Jul 10 '24 03:07 Rohini1206

make sure your client and secret id is correct

cuongdevjs avatar Jul 10 '24 04:07 cuongdevjs

make sure your client and secret id is correct

image

image

image

image

An in the code i have kept actual client_id and clientSecret , that i think i can not expose so i just replaced it.

Please advise me what is wrong i'm doing here.

Rohini1206 avatar Jul 11 '24 03:07 Rohini1206

If you look at your URL, you're receiving an unauthorized_scope_error while requesting r_liteprofile. Make sure that you have that scope under your Auth -> OAuth 2.0 scopes section or specify your scope as part of your component. ex: <LoginSocialLinkedin . . . scope="email">

allenazamoras avatar Nov 05 '24 20:11 allenazamoras