/authorize endpoint)./oauth/token endpoint) along with the application’s Client ID and Client Secret.
code_verifier and from this generates a code_challenge./authorize endpoint) along with the code_challenge./oauth/token endpoint).code_challenge and code_verifier.
/authorize endpoint) passing along a response_type parameter of id_token that indicates the type of requested credential. It also passes along a response_mode parameter of form_post to ensure security.
/oauth/token endpoint).
device_code, user_code, verification_uri, verification_uri_complete expires_in (lifetime in seconds for device_code and user_code), and polling interval.verification_uri and enter the user_code after displaying these values on-screenverification_uri_completeverification_uri_complete, if running natively on a browser-based device/oauth/token endpoint) using the time period specified by interval and counting from receipt of the last polling request’s response. The device app continues polling until either the user completes the browser flow path or the user code expires.
/oauth/tokenendpoint).Application and DocumentationApplications, name application Can of Books and create a Single Page Web AppSettings to get your domain, client secret key, client ID, etc.Auth0 in React front end
.env file to create:
REACT_APP_SERVER_URL=REACT_APP_DOMAIN=REACT_APP_CLIENT_ID=REACT_APP_REDIRECT_URI=LoginButton.jsLogoutButton.jsProfile.jsButton from React into the LoginButton and LogoutButton files and update the <button> tags to be Bootstrap components <Button>App.js, import Auth0:
import { withAuth0 } from '@auth0/auth-0-react'withAuth0 is for use on App level; useAuth0 is for functional componentsApp.js:
export default withAuth0(App);Add ternary to App.js to show a login vs. logout button:
{this.props.auth0.isAuthenticated ? <LogoutButton/> : <LoginButton/>}
Content.js file to add in the content that the user can expect to see if they successfully loginconst res = await this.props.auth0.getIdTokenClaims();const jwt = res.__raw;config object to make our call to the API using the token jwt:
let results = await axios(config)jwt = JSON web token (‘J Watt’)jwks = JSON Web Key Set (‘Ja-Wicks)
jwks key can be brought over from the Auth0 Advanced Settings section of the Application => Settings pagelet config = {
method: 'get',
baseURL: 'process.env.REACT_APP_SERVER_URL',
url: '/books',
header: {
"Authorization": `Bearer ${jwt}`
}
}