Skip to content

Error Trying to Save Token into SqliteTokenBackEnd #826

Answered by pkstacey
pkstacey asked this question in Q&A
Discussion options

You must be logged in to vote

I have since fixed the code after sorting out conflicting errors. The code as follows inserts the token into the db just fine:

`
import sqlite3
from O365 import utils

class SqliteTokenBackend(utils.BaseTokenBackend):

def __init__(self, db=None, table=None, column=None, user_id=None):
    super().__init__()  # must call it

    # this can be done in multiple ways ....
    self.db = db
    self.user_id = user_id
    self.get_statement = "SELECT {} FROM {} WHERE user_id = ?".format(column, table)
    self.update_statement = "UPDATE {} SET {} = ? WHERE user_id = ?".format(table, column) #token, user
    self.insert_statement = "INSERT INTO {} VALUES (?,?)".format(table) #token, user
    self.…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pkstacey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant