Last active
August 29, 2015 14:03
-
-
Save junojisan/7e0dbb360ccf63fde212 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class OAuthInitiateController { | |
public static final String CLIENT_ID = <CLIENT_ID>; | |
public static final String CLIENT_SECRET = <CLIENT_SECRET>; | |
public static final String CALLBACK_URL = 'https://xxxx/apex/OAuthCallback'; | |
public PageReference initiate(){ | |
String authorizeUrl = 'https://login.salesforce.com/services/oauth2/authorize'; | |
authorizeUrl += '?response_type=code'; | |
authorizeUrl += '&client_id=' + CLIENT_ID; | |
authorizeUrl += '&redirect_uri=' + CALLBACK_URL; | |
authorizeUrl += '&prompt=login consent'; | |
PageReference pref = new PageReference(authorizeUrl); | |
pref.setRedirect(true); | |
return pref; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment