There's specific words out there like 正典 meant for the Bible, but what's the common term for referring to a story. As in "the Christmas Special isn't canon for the Star Wars universe". I figure there must be one used casually for gamers, and manga and anime fans. I'd guess カノン but it's not in any dictionary I can find - so it might be slang.
Official as opposed to fanfiction/dojin is simply 公式.
But do you want to refer to the canonical story line as opposed to that of a spin-off based on an alternative/what-if story? Like "main" Attack on Titan as opposed to Attack on Titan: Junior High, or "main" Dragon Ball as opposed to That Time I Got Reincarnated as Yamcha? In this case, both are 公式, so to speak, but 本編(ストーリー) is the word to refer to the "main" story line. 正史 sounds grandiose but can be used if the story is very long like Star Wars. カノン seems to be used among hardcore fans of foreign fiction, but it's safe to say ordinary anime/manga/game fans do not recognize this term.
EDIT: In a rare situation where many titles that can be called 本編 conflict with one another and people want to agree on the "truely official" history, something simple like 公式設定 is used. See 宇宙世紀 for an example.