ok first , if you wanna have a Rooted stock Oreo Rom , you need to factory reset your device , so backup everything you need then follow the steps :
1- Download Odin 3.13.1 -------- TWRP 3.2.3 Recovery -------- Android 8.0 Oreo Stock Rom -------- Magisk v 17.1 -------- no-verity-opt-encrypt-6.0 .
Copy Magisk v17.1 and no-verity-opt files into your SD card , or you can copy them after you installed TWRP using mount !
2- Go to Odin , and flash the Stock Rom oreo , BUT before you start go to Options and deselect F. reset time and Auto reboot .
3- when the Rom flash is done . just hold Power + volume down + home buttons to restart the phone . keep holding the buttons to return Download mode again !
NOTE : you have to reboot to download mode again after flashing Stock Rom . bcuz odin wont install TWRP and will stop on waiting for connection if you do flash TWRP right after flashing rom without reboot ! just after flashing ROM , do a reboot with device buttons and keep holding them to go straight to download mode again . then you can flash TWRP .
4- now go to Odin again and now Flash the TWRP recovery . before you start go to options and deselect F .reset time and Auto reboot .
5- now hold Power + Volume down + Home buttons , when your device screen goes off , fast switch the buttons to Power + Volume up + home to boot into TWRP recovry .
6- now go to Wipe and select Format Data . it will ask you to type yes . type yes and continue . you do this to remove encryption on your phone memory .
NOTE : Just select Format data . DON'T select advanced wipe or swip to factory reset . you have to select Format data and it will ask you to type "yes" . do it and go on .
7- now go to reboot and reboot to TWRP recovery again ! ( you have to reboot to recovery bcuz you cant reach /DATA when you do Format data )
8- now go to install , and install Magisk and no-Verity-opt .
9- now restart your phone normaly and let it boot up and do the first boot settings .
10 - thats it , now you can see Magisk on your apps list and your Stock Rom is rooted .
NOTE : for the guys that already installed Stock oreo Rom , they dont need to flash Rom again , they can skip Step 2 and 3 !
just do all the steps 1 by 1 as i said and it will work 100% . some guys cant make it work bcuz : 1 - they dont do Format Data before installing Magisk and they get "cant mount /data error" and verification field pops up . 2- they do format data after installing magisk !!!! thats crazy bcuz you just clear Magisk when you do format data after installing it .
i hope this guide be helpful for you guys .