bhubr / react-simple-oauth2-login

Simple React component for OAuth2 login - Supports Authorization Code and Implicit Grant flows.
MIT License
49 stars 31 forks source link

How to specify scopes #21

Open nerdy-plutonian-ng opened 3 years ago

nerdy-plutonian-ng commented 3 years ago

How do I include scopes in my configuration please.

bhubr commented 3 years ago

Hello! Thanks for your question and sorry for the delayed answer. It's indicated under the Props section of the documentation: scope

Basically you have to give this scope prop the string containing relevant scope(s), separated by spaces. Example for Spotify (derived from the doc's example):

<OAuth2Login
    scope="user-top-read user-follow-read"
    authorizationUrl="https://accounts.spotify.com/authorize"
    responseType="token"
    clientId="9822046hvr4lnhi7g07grihpefahy5jb"
    redirectUri="http://localhost:3000/oauth-callback"
    onSuccess={onSuccess}
    onFailure={onFailure} />

Please let me know if this helped!