Three field-tested tweaks that keep your frames put, save your hairline, and stop the makeup smears.
Two bobby pins, one clean part, zero sliding

If your sunglasses fit fine in the store and then turn into a slip-n-slide the second you step outside, try this before you blame your nose. Part your hair where you normally do and tuck your frames on. Now take two bobby pins (the wavy kind, not the flat snap clips) and slide each one in right above the ear, crossing over the sunglasses arm so the pin grips hair and the arm at the same time. I angle the open end of the pin toward my face so it locks harder when I move. It looks like nothing from the front, and it keeps that annoying creep from happening when you sweat through your hairline or you keep pushing your frames up with SPF-slick fingers.
This is especially clutch if you wear your hair freshly washed and silky. Clean hair is great for shampoo ads, terrible for sunglasses. If you need more grab, hit just the section above your ears with a half-second mist of flexible hairspray (Tresemme Tres Two or L'Oreal Elnett both work), let it dry for ten seconds, and then pin. Don't spray the frames. You'll end up with sticky arms that collect lint and face powder like a magnet.
One detail that matters: use pins close to your hair color. Black pins in blond hair are loud, and gold pins can flash in the sun. Also, if your scalp is sensitive, don't crank the pin tight. You want a gentle clamp, not a headache. When this is done right, you can bend down to tie a sneaker, flick your hair back, and the frames stay put without leaving those little dents across your temples.
Stop the sunscreen slick: set your nose bridge on purpose

Most sunglasses don't slide because the frames are cursed. They slide because your nose and cheeks are basically glazed. Between moisturizer, sunscreen, and whatever you put on top, the bridge has no traction. The fix is boring but effective: give your sunglasses a dry landing pad.
Here's the order that works for me on sweaty, high-SPF days: skincare, then sunscreen, then wait. I mean a real wait. Two to three minutes is enough for a lot of formulas to settle so they're not sitting wet on the surface. If you're using something glossy like Supergoop! Glowscreen or a dewy tinted SPF, it's extra important. After that, press (don't rub) a tiny bit of translucent setting powder just on the nose bridge and the top of your cheeks where the frames touch. I use Laura Mercier Translucent Loose Setting Powder or the cheaper Maybelline Fit Me Loose, and I apply it with a small fluffy eyeshadow brush so I don't accidentally turn my whole face matte.
If you don't wear makeup, you can still do this. Powder isn't a moral commitment. You're just changing the friction. On truly humid days, I carry blotting papers (Clean & Clear works, so do the fancy Tatcha ones) and blot the bridge once, then put the sunglasses back on. That quick blot also cuts down on the two bonus problems nobody wants: sunscreen stinging your eyes and the grayish makeup smear your frames leave behind at 2 p.m.
A quick warning from doing this wrong: don't powder over sunscreen that's still wet, because you'll make a paste and it can pill when you slide your glasses up and down. Let it set, then powder lightly. Your sunglasses will stop skating, and your base makeup will look less like it's been erased in two angry stripes.
Adjust the nose pads with a tissue, not bare fingers

If your sunglasses have adjustable nose pads (the little silicone ovals on metal arms), you can usually stop sliding by changing the angle, not the glasses. I learned this after paying for an adjustment, then realizing the optician did something so small I could've done it at my kitchen counter.
Wrap a tissue or a clean washcloth around the pad so you don't get sunscreen, face oil, or setting powder all over it, and pinch the nose pads slightly inward. Slightly. You want the pads to hug the sides of your nose instead of perching on top like a diving board. Put them on, shake your head a little, and see where the pressure lands. If you feel it on the bridge like a pinch, you went too far. If the glasses still inch down when you look at your phone, go a hair more inward. Tiny moves add up fast.
Two things I do every time because I've messed them up before: I adjust both pads evenly, and I check them in front of a mirror with my hair up. When your hair is down, it can trick you into thinking the frames are steady because the arms are caught in hair. Later, you tuck your hair behind your ears and the glasses immediately start drifting. Also, if you wear base makeup, do the adjustment before you finish your face. The first few tries can leave little prints where the pads sit, and it's easier to tap those out with a sponge than to discover them when you're already out the door.
If your sunglasses don't have pads (plastic frames), don't try to bend them with heat unless you know what you're doing. I've warped a cheap pair into a permanent frown. With pads, though, this is safe, fast, and surprisingly satisfying. The frames stop sliding, and you stop touching your face all day, which is the best beauty tip nobody wants to hear twice.