sonyarouje / react-native-ad-b2c

React Native library for Azure Active Directory B2C
12 stars 6 forks source link

How we can receive refresh_token into credentials ? #8

Open HassanHaiderIX opened 3 years ago

HassanHaiderIX commented 3 years ago

I am having trouble to get refresh token. Once I get the token I stored it in async storage. I am not sure what steps do I have to follow to get refresh token successfully. Apparently there was an issue that was related but closed. https://github.com/sonyarouje/react-native-ad-b2c/issues/5

yumoraby commented 3 years ago

+1 would be interested on the best practice to refresh expired tokens

sonyarouje commented 3 years ago

Can call ReactNativeADB2C.js->assureToken() to refresh the token and return the new bearer token if expired. If you want to store tokens some where then can do the same in refreshToken (), some thing like this

      this.grantAccessToken(grantType, config)
        .then((resp) => {
         //store the resp.response in async storage.
          resolve(resp.response.access_token);
        })
        .catch((err) => {
          reject(err);
        });
    });

This is not a library, feel free to fork and modify the way you all wanted.