Search code examples
pythono365-flow

No genera el refresh_token en txt python-O365


Me encuentro utilizando la librería o365 de python y cuando genero el txt por medio de account.con.request_token(result_url) no me genera el refresh.token simplemente me genera el access_token, este es mi código

from O365 import Account

scopes_graph = protocols.get_scopes_for('message_send')
credential = ('client_id', 'client_secret')

account = Account(credentials=credential, scopes=scopes_graph)
account.con.get_authorization_url()
result_url = input('Paste the result url here...')
#'aqui crea el txt pero no genera el 
account.con.request_token(result_url) 
m = account.new_message() 
m.to.add('[email protected]')
m.subject = 'Testing!'
m.body = "George Best quote: I've stopped drinking, but only while I'm asleep."
m.send()

necesito el "refresh_token":"...." gracias


Solution

  • Only need used:

    Chage this:

    account = Account(credentials=credential, scopes=scopes_graph)
    account.con.get_authorization_url()
    result_url = input('Paste the result url here...')
    #'aqui crea el txt pero no genera el 
    account.con.request_token(result_url)
    

    by this code

    account = Account(credentials=credential, scopes=scopes_graph)
    account.authenticate(scopes=['basic', 'message_all'])