Home › Forums › FABRIC General Questions and Discussion › unable to get new Fabric Identity
- This topic has 14 replies, 2 voices, and was last updated 2 years, 9 months ago by Xusheng Ai.
-
AuthorPosts
-
January 23, 2022 at 2:58 pm #1252
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
January 23, 2022 at 3:04 pm #1253try: 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, 11 months ago by Xusheng Ai.
- This reply was modified 2 years, 11 months ago by Xusheng Ai.
January 24, 2022 at 10:23 am #1257If 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
January 24, 2022 at 10:35 am #1258Hello 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,
January 24, 2022 at 11:07 am #1259The 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?
January 24, 2022 at 11:10 am #1260Thanks for the illustration.
I am using the FABRIC Jupyterhub.
January 24, 2022 at 11:20 am #1261In 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
January 24, 2022 at 2:23 pm #1262Hello 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,
January 24, 2022 at 3:43 pm #1263Are you able to run the “Hello, FABRIC” example notebook?
January 24, 2022 at 8:26 pm #1267No, 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
February 11, 2022 at 12:30 pm #1358Hello,
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,
XushengFebruary 11, 2022 at 4:13 pm #1359This 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
February 11, 2022 at 4:17 pm #1360I 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 !!
February 28, 2022 at 11:32 am #1401Hello 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,
XushengMarch 1, 2022 at 1:47 pm #1402It works now, thanks so much for the help!
-
AuthorPosts
- You must be logged in to reply to this topic.