@@ -277,3 +277,51 @@ def backchannel_login(
277277 "grant_type" : grant_type ,
278278 },
279279 )
280+
281+ def federated_login (
282+ self ,
283+ subject_token_type : str ,
284+ subject_token : str ,
285+ requested_token_type : str ,
286+ login_hint : str | None = None ,
287+ scope : str | None = None ,
288+ connection : str | None = None ,
289+ grant_type : str = "urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token"
290+ ) -> Any :
291+ """Calls /oauth/token endpoint with federated-connection-access-token grant type
292+
293+ Args:
294+ subject_token_type (str): String containing the typpe of token.
295+
296+ subject_token (str): String containing the value of subject_token_type.
297+
298+ requested_token_type (str): String containing the type of rquested token.
299+
300+ connection (str, optional): Denotes the name of a social identity provider configured to your application
301+
302+ login_hint (str, optional): String containing information about the user to contact for authentication.
303+
304+ scope(str, optional): String value of the different scopes the client is asking for.
305+ Multiple scopes are separated with whitespace.
306+
307+ grant_type (str): Denotes the flow you're using. For Federated Connection Access token use
308+ urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token
309+
310+
311+ Returns:
312+ access_token, scope, issued_token_type, token_type
313+ """
314+
315+ return self .authenticated_post (
316+ f"{ self .protocol } ://{ self .domain } /oauth/token" ,
317+ data = {
318+ "client_id" : self .client_id ,
319+ "grant_type" : grant_type ,
320+ "subject_token_type" : subject_token_type ,
321+ "subject_token" : subject_token ,
322+ "requested_token_type" : requested_token_type ,
323+ "login_hint" : login_hint ,
324+ "connection" : connection ,
325+ "scope" : scope ,
326+ },
327+ )
0 commit comments