Search code examples
pythonweb-applicationsibm-cloudintegrationibm-appid

How to integrate bluemix APP ID service to python web application


I have tried the bluemix service 'APP ID' for node.js project which I downloaded from APP ID service instance only. The application runs well with Google and Facebook authentication.

But I have to apply authentication to Python Flask web application. For this,I have followed the github link . Here, I have provided 'clientid', 'secret' and 'redirect_uri' which I got from the 'Service Credentials' tab of the 'APP ID' instance in bluemix. After running the app, I am getting login page but when I click 'Login' button then I am getting the error 'tenandid is in invalid format'.

Please suggest where I am doing wrong.

Thanks in advance !

Regards, Rahul Modi


Solution

  • I solved the error my self. I just provided clientId, secret, redirectUri and serverUrl in the file serviceConfig.py file of the GitHub python project.

    There is need to change this file by providing the above parameters otherwise you may land into the error on the line "clientId = serviceConfig.clientId" of 'welcome.py' because clientId is not accessible from serviceConfig class. The same case for 'secret' as well. Hence, define them separately in serviceConfig.py file.

    The four parameters looks like below:

    serverUrl='https://appid-oauth.ng.bluemix.net/oauth/v3/1b668c6a-XXXX-XXXX-XXXX-c4633e8e0c78'

    redirectUri='http://localhost:5000/afterauth'

    secret='NjNiODY5NDQtOXXXXXXXXXXXXXXXXXXXXzUxNDMzNzYxYjAy'

    clientId='6284418c-XXXX-XXXX-XXXX-af8bf44588ec'

    All these parameters you can collect from the 'Service Credentials' tab of the 'APP ID' instance in Bluemix.

    Note: No need to change anything in 'welcome.py' file.