File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,9 @@ async def async_get_access_token(self) -> str:
145145 access_token = str (self ._oauth_session .token ["access_token" ])
146146 LOG .debug ("Websocket access token is %s" , access_token )
147147
148+ urn = self .urn
149+ LOG .debug ("Extracted URN: %s" , urn )
150+
148151 return str (self ._oauth_session .token ["access_token" ])
149152
150153 @property
@@ -162,7 +165,12 @@ def urn(self) -> str | None:
162165
163166 decoded = base64 .urlsafe_b64decode (payload_part )
164167 claims = json .loads (decoded )
165- self ._urn = claims .get ("urn" )
168+ urn_claim = claims .get ("urn:com:hiloenergie:profile:location_hilo_id" )
169+ if urn_claim and isinstance (urn_claim , list ) and len (urn_claim ) > 0 :
170+ self ._urn = urn_claim [0 ] # Get the first URN from the array
171+ else :
172+ self ._urn = None
173+
166174 return self ._urn
167175 except (IndexError , json .JSONDecodeError , KeyError ):
168176 LOG .error ("Failed to extract URN from access token" )
You can’t perform that action at this time.
0 commit comments