150 auth0 developpement#151
Open
Pranxtor wants to merge 6 commits into
Open
Conversation
Collaborator
Pranxtor
commented
Jan 11, 2023
- Does not log the user out when changing pages or when a page is refreshed
- Adds authentication to requests made from the front to the back
- Checks that the user is logged into the application before using the backend on the data
3 tasks
48cb243 to
046ec2d
Compare
sazulo
reviewed
Jan 16, 2023
| return api | ||
| } | ||
|
|
||
| export const apiWithoutToken = axios.create({ |
Collaborator
Author
There was a problem hiding this comment.
c'est utilisé dans les tests
|
|
||
| export const api = axios.create({ | ||
| export async function useApi () { | ||
| const token = await client.value.getAccessTokenSilently() |
There was a problem hiding this comment.
Préfère un truc du genre:
const auth0 = useAuth0()
const api = axios.create({
baseURL: process.env.VUE_APP_SERVER || 'http://localhost:3000',
timeout: 60000,
headers: {},
})
api.interceptors.request.use(async (config) => {
const token = await auth0.getAccessTokenSilently()
config.headers.Authorization = `Bearer ${token}`
})
return api
There was a problem hiding this comment.
|
|
||
| export const client = ref(null) | ||
|
|
||
| export function exposeAuth0 () { |
There was a problem hiding this comment.
Je ne comprends pas a quoi sert ce plugin ?
Collaborator
Author
There was a problem hiding this comment.
c'est un plugin que j'ai créer pour pouvoir accéder à auth0 en dehors des components
Collaborator
Author
There was a problem hiding this comment.
Comment on lines
12
to
19
| createAuth0({ | ||
| domain: process.env.VUE_APP_AUTH0_DOMAIN, | ||
| client_id: process.env.VUE_APP_AUTH0_CLIENT_ID, | ||
| redirect_uri: window.location.origin | ||
| redirect_uri: window.location.origin, | ||
| audience: process.env.VUE_APP_AUTH0_API_ID | ||
| }) | ||
| ) | ||
| ).use(exposeAuth0()) | ||
|
|
There was a problem hiding this comment.
Je ne comprends pas ca non plus. Selon la doc de auth0 :
app.use(
createAuth0({
domain: '<AUTH0_DOMAIN>',
client_id: '<AUTH0_CLIENT_ID>',
redirect_uri: '<MY_CALLBACK_URL>',
audience: '<AUTH0_AUDIENCE>'
})
);
There was a problem hiding this comment.
Collaborator
Author
There was a problem hiding this comment.
c'est en lien avec le plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.