1. unable to get new Fabric Identity

unable to get new Fabric Identity

Home Forums FABRIC General Questions and Discussion unable to get new Fabric Identity

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #1252
    Xusheng Ai
    Participant

      Hi, I’m working on that uses orchestrator APIs for user experiments with the example on Github. I tried to get new Fabric Identity Token and update Fabric Refresh Token, but it showed invalided refresh token.  I was wondering if you could help explain what happened, I will be grateful for your help.

      I attached my jupyter notebook file below, please let me know if there is a better way to attach my code,

      Xusheng Ai

      #1253
      Xusheng Ai
      Participant
        try:
        refresh_res = credmgr_proxy.refresh(project_name='all', scope='all', refresh_token=fabric_refresh_token)
        print("New Tokens received: {}".format(json.dumps(refresh_res)))
        fabric_id_token = refresh_res['id_token']
        fabric_refresh_token = refresh_res['refresh_token']
        print()
        print("New Refresh Token:{}".format(fabric_refresh_token))print()
        print("Stored new Refresh Token")
        %store fabric_refresh_token
        except Exception as e:
        print("Exception occurred while getting tokens:{}".format(e))

        Exception occurred while getting tokens:Object of type Status is not JSON serializable

        print(refresh_res)
        (<Status.FAILURE: 3>, {‘error’: ‘(invalid_grant) invalid refresh token’, ‘created_at’: ‘2022-01-23 19:35:59’})

        • This reply was modified 2 years, 2 months ago by Xusheng Ai.
        • This reply was modified 2 years, 2 months ago by Xusheng Ai.
        #1257
        Paul Ruth
        Keymaster

          If the token is correct then it should work.   One quirk of Jupyter notebooks is that if you changed something outside of an open notebook you likely need to force the notebook to re-read the update.  I often see this when I update a library (i.e pip install X) or fetch a new token.

          Depending on your setup,  you will at least need to restart the Jupyter kernel by clicking the button with the arrow that loops in a circle.   If you are running this in a custom setup, might need to reload the browser tab that is running the notebook.

          Let me know if this solves the problem.

          Paul

          #1258
          Xusheng Ai
          Participant

            Hello Paul,

            If my bastion account hasn’t been created, will that cause error like this? I’v submitted my public Key to Fabric, but the account may not be created yet.

            Thanks,

            #1259
            Paul Ruth
            Keymaster

              The bastion key is only needed when you ssh to your VMs.  Invalid token is a separate issue.

              Are you using the FABRIC Jupyterhub or tying to install the API on your own system?

              #1260
              Xusheng Ai
              Participant

                Thanks for the illustration.

                I am using the FABRIC Jupyterhub.

                #1261
                Paul Ruth
                Keymaster

                  In the FABRIC Juypyter hub it should just work.  The tokens do expire and it is possible to invalidate your token.  If you lost your token you will need to log out/in to get a new token.

                  Paul

                  #1262
                  Xusheng Ai
                  Participant

                    Hello Paule,

                    I have tired to restart the kernel and also log out/in my account, but I still cannot get new Fabric Identity Token and update Fabric Refresh Token. Same error as before.

                    Thanks,

                    #1263
                    Paul Ruth
                    Keymaster

                      Are you able to run the “Hello, FABRIC” example notebook?

                      #1267
                      Xusheng Ai
                      Participant

                        No, it didn’t work out. I think it is because the same issue of invalid refresh token. I much appreciate your time and help, please see the information below,

                        The error happened at line:

                        slice_manager = SliceManager(oc_host=os.environ['FABRIC_ORCHESTRATOR_HOST'], 
                                                     cm_host=os.environ['FABRIC_CREDMGR_HOST'] ,
                                                     project_name='all', 
                                                     scope='all')

                        error information:

                        —————————————————————————
                        SliceManagerException Traceback (most recent call last)
                        /tmp/ipykernel_68/23525788.py in <module>
                        4
                        5
                        —-> 6 slice_manager = SliceManager(oc_host=os.environ[‘FABRIC_ORCHESTRATOR_HOST’],
                        7 cm_host=os.environ[‘FABRIC_CREDMGR_HOST’] ,
                        8 project_name=’all’,

                        /opt/conda/lib/python3.9/site-packages/fabrictestbed/slice_manager/slice_manager.py in __init__(self, cm_host, oc_host, token_location, project_name, scope, initialize)
                        61 self.initialized = False
                        62 if initialize:
                        —> 63 self.initialize()
                        64
                        65 def initialize(self):

                        /opt/conda/lib/python3.9/site-packages/fabrictestbed/slice_manager/slice_manager.py in initialize(self)
                        70 “””
                        71 if not self.initialized:
                        —> 72 self.__load_tokens()
                        73 self.initialized = True
                        74

                        /opt/conda/lib/python3.9/site-packages/fabrictestbed/slice_manager/slice_manager.py in __load_tokens(self)
                        113 # First time login, use environment variable to load the tokens
                        114 refresh_token = os.environ[Constants.CILOGON_REFRESH_TOKEN]
                        –> 115 self.refresh_tokens(refresh_token=refresh_token)
                        116
                        117 def get_refresh_token(self) -> str:

                        /opt/conda/lib/python3.9/site-packages/fabrictestbed/slice_manager/slice_manager.py in refresh_tokens(self, refresh_token)
                        151 self.tokens = tokens
                        152 return tokens.get(CredmgrProxy.ID_TOKEN, None), tokens.get(CredmgrProxy.REFRESH_TOKEN, None)
                        –> 153 raise SliceManagerException(tokens.get(CredmgrProxy.ERROR))
                        154
                        155 def revoke_token(self, *, refresh_token: str = None) -> Tuple[Status, Any]:

                        SliceManagerException: (invalid_grant) invalid refresh token

                        #1358
                        Xusheng Ai
                        Participant

                          Hello,

                          Sorry to bother, but (invalid_grant) invalid refresh token happened again, when I tried to create a slice. I’v tried to find a solution online last week, but it seems none of the solution works for me. I was wondering if you could hint me what might cause it happen. Thank you very much in advance.


                          SliceManagerException Traceback (most recent call last)
                          /tmp/ipykernel_130/23525788.py in <module>
                          4
                          5
                          —-> 6 slice_manager = SliceManager(oc_host=os.environ[‘FABRIC_ORCHESTRATOR_HOST’],
                          7 cm_host=os.environ[‘FABRIC_CREDMGR_HOST’] ,
                          8 project_name=’all’,
                          SliceManagerException: (invalid_grant) invalid refresh token

                          Thanks,
                          Xusheng

                          #1359
                          Paul Ruth
                          Keymaster

                            This is no problem.

                            We might have to have a zoom call to see what is going on here.

                            Have you ever had a slice work? If not, something might have gone wrong with your account creation.

                            It’s worth mentioning that starting Monday there will be a 2 week scheduled outage for maintenance.  This might need to wait until after then.   There will also be a lot of updates during the outage.  You problem might be fixed by then.

                            Paul

                            #1360
                            Xusheng Ai
                            Participant

                              I haven’t had a slice work before, but I will try that after the maintenance. If it didn’t work out, a zoom call would be perfect. Thanks so much !!

                              #1401
                              Xusheng Ai
                              Participant

                                Hello Paul,

                                I’m trying to create a slice on Fabric Testbed after the maintenance. However, the invalid refresh token still shows up. I think I missed something when I try to create the slice but cannot find where I did wrong. I was wondering if it was possible to schedule a zoom call with you.

                                Thanks for your help,
                                Xusheng

                                #1402
                                Xusheng Ai
                                Participant

                                  It works now, thanks so much for the help!

                                Viewing 15 posts - 1 through 15 (of 15 total)
                                • You must be logged in to reply to this topic.