def oauth_authentication_flow(client_id, client_secret, scopes=None,<EOL>protocol=None, **kwargs):
credentials = (client_id, client_secret)<EOL>protocol = protocol or MSGraphProtocol()<EOL>con = Connection(credentials, scopes=protocol.get_scopes_for(scopes),<EOL>**kwargs)<EOL>consent_url = con.get_authorization_url(**kwargs)<EOL>print('<STR_LIT>')<EOL>print(consent_url)<EOL>token_url = input('<STR_LIT>')<EOL>if token_url:<EOL><INDENT>result = con.request_token(token_url, **kwargs)<EOL>if result:<EOL><INDENT>print('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>return bool(result)<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>')<EOL>return False<EOL><DEDENT>
A helper method to perform the OAuth2 authentication flow.
    Authenticate and get the oauth token

    :param str client_id: the client_id
    :param str client_secret: the client_secret
    :param list[str] scopes: a list of protocol user scopes to be converted
     by the protocol or raw scopes
    :param Protocol protocol: the protocol to be used.
     Defaults to MSGraphProtocol
    :param kwargs: other configuration to be passed to the Connection instance,
     connection.get_authorization_url or connection.request_token
    :return: Success or Failure
    :rtype: bool