See my reply to him rather than my repeating it and boring people.I'm basically with @The Revolting Man on this one. I know nothing about bears but I'd be going for the shortest 12G semi or pump that is legal where you are as backup, standard size magazine, loaded with slugs. Or even just a double barrel. If you have to use your backup against a charging bear you're going to have so little time you'll struggle to get off more than a couple of shots before it's on you anyway, so they need to be something that will count - but also from a small enough gun that you can actually get it on target in an awkward situation. I don't have any experience with large calibre handguns and appreciate they'd probably be a good option also, but you can't beat a 12G slug for stopping power at close range.
And I'd persuade @MemeFan to ditch the flamethrower and take a shotgun instead also!
I like a shotgun for that type of thing for backing up friends when I take them hog hunting. I also prefer a lot of ammunition left in the magazine after the shooting is done... the notion I was proposing is a comedic farse but the details I put in were intentional based on experience in hunts and people's real world accuracy under stress while being charged by huge scary hogs, much less our hair on fire godzilla of bears coming to eat you.