Legacy Dev Forum Posts

 View Only

Sign Up

Premium App - 401 Invalid Login Credentials

  • 1.  Premium App - 401 Invalid Login Credentials

    Posted 06-05-2025 18:47

    KBN | 2018-10-10 00:38:11 UTC | #1

    Hi Team,

    I have downlaoded the sample premium app (https://github.com/MyPureCloud/purecloud-premium-app) and running it on a local Node.js. To test-run it locally, I have done some changes and configs as below:

    Client_app.js:

    wizard-app.js:

    PureCloud OAuth:

    Replaced the OAuth Client ID (created above) in config.js and clientIDs.js (not shown here).

    I have the following configured under Integrations -> Premium Client Application Example -> Application URL:

    https://localhost/wizard/index.html?langTag={{pcLangTag}}&environment={{pcEnvironment}}

    However, when I access Premium App under Apps menu, I get the below error:

    And that is what I see in logs ("Unauthorized"):

    I have tried by creating new OAuth clients but still no luck. And I'm the Admin so I have full rights on PureCloud org.

    Any thoughts on what am I missing here?

    Is there anyother place where I have to set the environment variable, or change the redirect URL?

    Thanks.


    anon28885283 | 2018-10-10 03:20:17 UTC | #2

    Hi,

    Have you also updated the redirectUri from wizard/scripts/config.js?

    For the Authorized redirect URIs on your OAuth config, you'd also need to add:

    • (root)/index.html
    • (root)/supervisor.html

    for the sample applications.


    KBN | 2018-10-10 06:32:45 UTC | #3

    Hi Prince,

    Thanks for your quick response.

    anon28885283, post:2, topic:3703
    Have you also updated the redirectUri from wizard/scripts/config.js?

    Yes, I have:

    anon28885283, post:2, topic:3703
    For the Authorized redirect URIs on your OAuth config, you'd also need to add:
    • (root)/index.html
    • (root)/supervisor.html

    for the sample applications.

    OK, I have just added these two as well.

    But unfortunately, still no luck. What else can I check?


    anon28885283 | 2018-10-10 10:38:52 UTC | #4

    Hi, I found the issue is persisting the dynamic query parameters before authenticating to PureCloud. I've just pushed an update to the project, could you try it again?


    KBN | 2018-10-10 20:20:54 UTC | #5

    Thanks Prince.

    I just downloaded the updated source and tried again, but still doesn't work.

    Not sure if it can help in your investigation, but I did notice that it shows the following page for half a second and then throws the same erro message i.e. "Your Client Id is invalid or has expired":


    anon28885283 | 2018-10-11 04:29:25 UTC | #6

    Thanks for the information KBN,

    I've pushed new changes to the repo, please try it. A couple of things:

    • You don't have to manually set the environment anymore as it should be determined by the app through the query parameter (environment={{pcEnvironment}})
    • Configuration is centralized on config/config.js This should now be the only place where you would set changes for the sample app.

    If you're still experiencing the same issue, please try loading the page on a separate tab and supplying the query parameters manually. (e.g. https://localhost/wizard/index.html?langTag=en-us&pcEnvironment=mypurecloud.com.au)

    It should redirect to the page login.mypurecloud.com.au

    The error message should ony appear if the client id supplied is incorrect or the login page environment does not match the environment of the purecloud org where the oauth was created.

    EDIT: console logs would also be helpful if you're experiencing any issues.


    KBN | 2018-10-11 07:58:54 UTC | #7

    Great work Prince, its working now!

    Thank you for all of your help!! :slight_smile:


    system | 2018-11-11 07:58:59 UTC | #8

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 3703