05-02-2024 06:07 PM - edited 05-02-2024 06:12 PM
Is there any option to create or get a webex bearer token by using webex email and password in the nodejs code? Or is it have any other option to get a rest api authentication like Oauth2.0 token???
05-03-2024 12:42 AM
Hi @mococo,
You can use the Webex Integration as documented here to generate Access Token and Refresh Token pair following the OAuth2.0 standard - https://developer.webex.com/docs/integrations
Basically this Webex Integration would provide you the credentials like, OAuth Authorization URL, client_id, client_secret
And, if you use the OAuth Authorization URL in a Browser (better use this URL in private mode of the Browser) and browse through it, you can generate the one time access Code by authenticating yourself using your Webex account.
In the URL section of your Browser, you can find the One time access Code.
Now using all these parameters, you can use the API - https://webexapis.com/v1/access_token and programmatically generate the Access Token & Refresh Token pair.
I've shared a sample screenshot from POSTMAN to show how these parameters could be used to generate the Token in POSTMAN -
Same steps have been documented in the Webex Integration page I referred above as well.
You can implement the same in your Code version as well.
But just using your Webex Username and Password, you can complete this task though. You must need a Integration to get the credentials first.
Hope this helps!
Regards,
Sandip
06-05-2024 07:19 PM
Hi @sandiban
I want to get Token in java, but I can't get the code on the browser.How can I do it? Thank you.
06-09-2024 10:45 PM - edited 06-09-2024 10:46 PM
Hi @thisxiaoming,
Actually the code should be generated in the Browser URL section.
Once you run the Integration OAuth Authorization URL in Browser, it should ask you for the Webex Sign-In and once the successful sign-in is complete, it should take you the landing page as per the "redirect_url" value you've set in the Integration settings and once you're on the landing page - kindly check that page URL or, the Browser URL of that page.
May be copy that entire code and paste in a notepad file. You should be able to find a parameter in the URL showing as "code=" as I shared in the attached screenshot.
Please note, in my case my Webex integration "redirect_url" was "https://localhost".
You should copy the entire "code" value from there and start using it in your /access_token API Request.
Please let us know if you've any further queries.
Regards!
Sandip
05-07-2024 11:58 PM
How to get a code parameter? I can find grant_type, cliend_id, client_secert and redirect_uri option but I don't know where to get a code option.
05-02-2024 11:11 PM
No, you cannot get a token programmatically.
Depending on you app, you have either
* to run the OAuth flow for an integration and the user has to provide it's credentials
* use the token that was provided during creation for a bot
* use the tokens provided when authorizing a service app during creation.
So what is your use case? Have a look at service apps, maybe that is what you're looking for
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide