Context package: Get access_token from a function that is not a component
Hi, I'm using the context package. I wan't to get the access_token from an async function that call an api. Using the redux package I'm doing something like store.getState().oidc.user.access_token but can't find the way to do this on context.
This is my code where I want to add the access token:
export async function getList() {
return fetch('https://run.mocky.io/v3/4b283449-3707-45a0-8571-729bbde89c38').then(response =>
response.json(),
)
}
Thank you very much in advance.
Hi @beckerpablo ,
Thank you for your issue and using, the lib!
Below a link of an internal sample of how the lib redux-fetch retrieve the tokens in a redux way : https://github.com/AxaGuilDEv/react-oidc/blob/master/packages/redux-fetch/src/withFetchToken.ts
You can also use directly that lib, that inject the tokens for you : https://github.com/AxaGuilDEv/react-oidc/tree/master/packages/redux-fetch#readme.md
Hi @beckerpablo , do you solve you problem?
Hi Guillaume, how are you?
I solved it using oidc react redux without the fetch plugin. Do you know if you are going to add the possibility to customize the redirect component like you did in oidc context?
Thank you very much,
Pablo Becker 3Pi Factory - Business Solutions Av. Corrientes 1386 piso 10 - C1043ABN - Buenos Aires - Argentina t. +54 11 7078.0323 Ex.102 c. +54 9 11 5842.7777 www.3pifactory.com http://www.3pifactory.com/
[image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5& Remitente notificado con Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5& 09/07/20, 10:12:51 AM
On Sun, Sep 6, 2020 at 12:38 PM Guillaume Chervet [email protected] wrote:
Hi @beckerpablo https://github.com/beckerpablo , do you solve you problem?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AxaGuilDEv/react-oidc/issues/505#issuecomment-687822350, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGIQACDDJZWDLEMFIALMBW3SEOUHHANCNFSM4PW7FWBQ .
Yes we have add it. Do you need it soon?
Great!, Before the end of year.
Thank you very much! you did a great job!
Pablo Becker 3Pi Factory - Business Solutions Av. Corrientes 1386 piso 10 - C1043ABN - Buenos Aires - Argentina t. +54 11 7078.0323 Ex.102 c. +54 9 11 5842.7777 www.3pifactory.com http://www.3pifactory.com/
[image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5& Remitente notificado con Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5& 09/08/20, 11:47:49 AM
On Tue, Sep 8, 2020 at 3:51 AM Guillaume Chervet [email protected] wrote:
Yes we have add it. Do you need it soon?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AxaGuilDEv/react-oidc/issues/505#issuecomment-688657074, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGIQACE5RZMISQIJQX4QCU3SEXH5LANCNFSM4PW7FWBQ .
Hi @beckerpablo , very sorry for the delay. It is possible to do this o the v5 version by using vanillajs files directly. I will add more documentation as soon as vanillajs code will be more stable. Do you still need this?
Hi @beckerpablo . I close the issue. It is out of date. Thank you very much for it.