Q:

How to do oAuth within Visualforce and be redirected back to the visual force page

FINAL*
Ok, so first lesson, do not stay up to late
Second for those that may need:

First URL needs to end in authorization
This returns a CODE
the second needs to be an HTTPRequest with response with the url ending in token
This will return the appropriate results.

Oh, and set your callback to https://na1.salesforce.com/apex/pagename
UPDATE
I go the original stuff worked out now the issue is that I need to have the callback url be a visual force page that could be on any instance
Right now I have it set to:
https://login.salesforce.com/apex/pagename
it does take me to the page but will not pass along the results of the oAuth
if I changed the call back url to:
na15.salesforce.com/apex/pagename
the parameters are there.
As with any managed package it could be installed on any instance so how the heck do I get it to return the the users instance / package page / along with the results of the oAuth...

I need to authorize a connected app that is 100% native inside of salesforce.
That part I got down.
BUT
I end up at the the redirect URL of https://login.salesforce.com/services/oauth2/success which just displays "Remote Access Authorized" or something like that....
I need the refresh token, so how do I get the user redirected back to the visual force page to capture the refresh token?
I must be missing something simple.....
Keep in mind that the page could be on any instance.....

A:

Mention the redirect URL as your visuslforce page only instead of oauth success url.The VF Url will have access token that you can get using apexpages.currentpage.parameters.get('refresh token')

