I want to add dynamic OAuth Redirect URL

  • 1
  • Problem
  • Updated 1 year ago
I want to add the App for get Call details in my magento 1.7.2 site. I want to add this functionality in admin panel. admin has dynamic url in customer module. then how to i add OAuth Redirect URI.
Photo of Darshan Gondaliya

Darshan Gondaliya

  • 80 Points 75 badge 2x thumb

Posted 1 year ago

  • 1
Photo of AK

AK, Official Rep

  • 4,372 Points 4k badge 2x thumb
You should be able to add one or more OAuth RedirectURI's into your application during development ( Sandbox ). 

Please Login to the Developer Portal and click on the application:

Head over to Settings -> OAuth Settings you should be able to add the redirectUri




For any OAuth Redirect URI additions into the application once the app has been approved for Production, please send out an email to devsupport@ringcentral.com with the necessary details and the team would add it.
Photo of Darshan Gondaliya

Darshan Gondaliya

  • 80 Points 75 badge 2x thumb
You are not getting my point. I know i can add the url there but my url has one random key associated. it will be change every time so how can i add url with dynamic generated key ?
Photo of John Wang

John Wang, Official Rep

  • 4,798 Points 4k badge 2x thumb
To add a random key, what is typically done is to add a 'state' query parameter to the Authorization URL. When this is done the 'state' parameter with the same value will be passed back to the Redirect URI. The state parameter does not have to be added to your Redirect URI endpoint in the Developer Portal.

You can read more about the state parameter in the OAuth spec here:

https://tools.ietf.org/html/rfc6749#section-4.1.1

You can see an example of this in the Ruby Sinatra OAuth 2.0 demo:

Pass in the state parameter
auth_url = client.authorize_url(state: state)
https://github.com/ringcentral/ringcentral-demos-oauth/blob/master/ruby-sinatra/app.rb#L25

Retrieve the state parameter parameter paramter in your Redirect URI
state = params.key?('state') ? params['state'] : ''
https://github.com/ringcentral/ringcentral-demos-oauth/blob/master/ruby-sinatra/app.rb#L32
(Edited)
Photo of AK

AK, Official Rep

  • 4,372 Points 4k badge 2x thumb
Hi Darshan,

Sorry, my bad I did not understand the question. I guess the usage of Wildcards will solve the purpose for you. 

Below is an example of how to use wildcards:

Let's say your redirectURI looks like this:

http://localhost:8080/callback.php

You could add the redirectUri on your application as:

http://localhost:*/callback.php

Let us know if you still have any issues using the Wildcards within the redirectURI. 
(Edited)