Legacy Dev Forum Posts

 View Only

Sign Up

  • 1.  OAuth Redirect URI

    Posted 06-05-2025 18:10

    GenesysCommunity | 2016-06-08 15:23:26 UTC | #1

    I am having trouble setting up OAuth using the PureCloud javascript client (https://github.com/MyPureCloud/purecloud_javascript_client). Specifically I'm having trouble getting it to accept my redirect url. This is how I initiate the authentication:

    var pureCloudSession = new PureCloudSession();

    var clientId = '<myClientId>';

    var redirectUri = 'https://c.na34.visual.force.com/apex/Plan_Task_Resolution?view=Overdue&planId=a0X610000017435EAA&taskDefId=a0O61000001iN7SEAU';

    pureCloudSession.authorize(clientId, redirectUri).done(function(){

    console.log('done method'); });

    When that executes I end up with a "invalid redirect uri error"

    I have the following urls configured for my OAuth application client in PureCloud: https://c.na34.visual.force.com https://c.na34.visual.force.com/apex/Plan_Task_Resolution https://c.na34.visual.force.com/apex/Plan_Task_Resolution?view=Overdue&planId=a0X610000017435EAA&taskDefId=a0O61000001iN7SEAU https://c.na34.visual.force.com/apex/Plan_Task_Summary As you can see, the third entry matches the value used by the javascript exactly, so I'm not sure why it isn't working as a redirect url. Can anybody help me out here?

    Thanks

    P.S. I was able to get "https://c.na34.visual.force.com/apex/Plan_Task_Summary" as my redirect url without issue, so maybe the issue is having query parameters in the url or something like that.


    KevinGlinski | 2016-06-08 15:16:51 UTC | #2

    You'll want to send the query string in the state param of the authorize method. after the auth redirect is done, you can call pureCloudSession.getState() and get that string back.

    var pureCloudSession = new PureCloudSession(); var clientId = '<myClientId>'; var redirectUri = 'https://c.na34.visual.force.com/apex/Plan_Task_Resolution';

    pureCloudSession.authorize(clientId, redirectUri, 'view=Overdue&planId=a0X610000017435EAA&taskDefId=a0O61000001iN7SEAU').done(function(){

    console.log('done method'); console.log(pureCloudSession.getState()); });


    balmerhevi | 2016-11-09 07:00:43 UTC | #3

    try this one, more about...URL Redirection

    Balmer


    tim.smith | 2016-11-09 15:45:56 UTC | #4


    This post was migrated from the old Developer Forum.

    ref: 20