3 types of temptations
Do not love the world or the things in the world. If anyone loves the world, the love of the Father is not in him. For all that is in the world — the lust of the flesh, the lust of the eyes, and the pride of life — is not of the Father but is of the world. And the world is passing away, and the lust of it; but he who does the will of God abides forever [1 John 2:15-17]
How to resist temptations
Therefore submit to God. Resist the devil and he will flee from you [James 4:7]
My understanding of the above verse is we must submit to God, then resist with God’s help. I do not think we are able to resist using our own strength.
A promised help to resist temptations
No temptation has overtaken you except such as is common to man; but God is faithful, who will not allow you to be tempted beyond what you are able, but with the temptation will also make the way of escape, that you may be able to bear it. [1 Corinthians 10:13]
What if we fail to resist temptations?
If we confess our sins, He is faithful and just to forgive us our sins and to cleanse us from all unrighteousness. [1 John 1:9]